Pre-fetching data from buckets in remote storage for a cache

ABSTRACT

Embodiments are disclosed for a prefetching method that may include copying, in response to a search query, a first bucket from a remote storage to a cache. The first bucket may include first data associated with the search query. The method may further include identifying a first file type associated with a first file in the first bucket. The first file may be associated with a usage status. The method may further include accessing, based on the search query, a second bucket from the remote storage. The second bucket may include second data associated with the search query. The method may further include identifying a second file in the second bucket having the first file type, and copying, in response to the usage status indicating that the first file was used in processing the search query, the second file from the remote storage to the cache.

BACKGROUND

In order to manage costs and accessibility, data is typically stored indata stores with varying access times (e.g., latency). That is, somedata may be stored in a limited capacity, high-speed, expensive cache,while other data may be stored in high capacity, low-speed, inexpensiveremote storage. Various strategies have been used to predict what datashould be stored locally, and when such data should be transferred fromremote storage to the cache. Because the cache has limited capacity,preferably only a minimum amount of data is obtained in advance fromremote storage to the cache.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 illustrates a networked computer environment in which anembodiment may be implemented.

FIG. 2 illustrates a block diagram of an example data intake and querysystem in which an embodiment may be implemented.

FIG. 3 is a flow diagram that illustrates how indexers process, index,and store data received from forwarders in accordance with the disclosedembodiments.

FIG. 4 is a flow diagram that illustrates how a search head and indexersperform a search query in accordance with the disclosed embodiments.

FIG. 5 illustrates an example scenario where a common customer ID isfound among log data received from three disparate sources in accordancewith the disclosed embodiments.

FIG. 6 illustrates a block diagram of an example cloud-based data intakeand query system in which an embodiment may be implemented.

FIG. 7 illustrates a block diagram of an example data intake and querysystem that performs searches across external data systems in accordancewith the disclosed embodiments.

FIG. 8A illustrates a block diagram of an example cache manager in whichan embodiment may be implemented.

FIG. 8B illustrates a block diagram of an example search bucketpredictor in which an embodiment may be implemented.

FIG. 9, FIG. 10, and FIG. 11 show flowcharts in accordance with one ormore embodiments of the invention.

FIG. 12, FIG. 13A and FIG. 13B show flowcharts in accordance with one ormore embodiments of the invention.

FIG. 14A, FIGS. 14B, and 15 show examples in accordance with one or moreembodiments of the invention.

DETAILED DESCRIPTION

Embodiments are described herein according to the following outline:

1.0. General Overview

2.0. Operating Environment

-   -   2.1. Host Devices    -   2.2. Client Devices    -   2.3. Client Device Applications    -   2.4. Data Server System    -   2.5. Data Ingestion        -   2.5.1 Input        -   2.5.2. Parsing        -   2.5.3. Indexing    -   2.6. Query Processing    -   2.7. Field Extraction    -   2.8. Cloud-Based System Overview    -   2.9. Searching Externally Archived Data        -   2.9.1. ERP Process Features            3.0. Caching Subsystem    -   3.1. Cache Manager    -   3.2. Search Bucket predictor    -   3.3. Prefetching and Cache Aware Searching Methods    -   3.4 Examples

Specific embodiments of the invention will now be described in detailwith reference to the accompanying figures. Like elements in the variousfigures are denoted by like reference numerals for consistency.

In the following detailed description of embodiments of the invention,numerous specific details are set forth in order to provide a morethorough understanding of the invention. However, it will be apparent toone of ordinary skill in the art that the invention may be practicedwithout these specific details. In other instances, well-known featureshave not been described in detail to avoid unnecessarily complicatingthe description.

Throughout the application, ordinal numbers (e.g., first, second, third,etc.) may be used as an adjective for an element (i.e., any noun in theapplication). The use of ordinal numbers is not to imply or create anyparticular ordering of the elements nor to limit any element to beingonly a single element unless expressly disclosed, such as by the use ofthe terms “before”, “after”, “single”, and other such terminology.Rather, the use of ordinal numbers is to distinguish between theelements. By way of an example, a first element is distinct from asecond element, and the first element may encompass more than oneelement and succeed (or precede) the second element in an ordering ofelements.

EXECUTIVE SUMMARY

In general, embodiments of the invention involve pre-fetching data froma remote storage to a cache. In one or more embodiments, the data may bepartitioned into buckets. Each bucket may contain a set of files (e.g.,to be used while processing the search query). In one or moreembodiments, a file in a candidate bucket may be prefetched based onwhether one or more files having the same file type that were prefetchedin one or more other buckets. For example, if index files wereprefetched in at least one of the two most recently processed buckets,then a decision to prefetch the index file in the candidate bucket maybe made.

The number of prefetched files in the cache may be based on the size ofa bucket prefetch window. The size of the bucket prefetch window may bedynamically adjusted based on the performance of a search relative tothe list of buckets. For example, when most files used to search abucket are already stored in the cache, then fewer additional files maybe prefetched, and the size of the bucket prefetch window may shrink.However, when most files used to search a bucket are stored remotely,incurring longer access times as requested data is copied from theremote storage to the cache, then additional files may be prefetched,and the size of the bucket prefetch window may expand. That is,execution of the search query may continue on prefetched files whilewaiting for other requested files to be copied from the remote storageto the cache.

The size of the bucket prefetch window may be based on a ratio of thewait time to the search time for a processed bucket. The wait time isthe time that a search spends waiting for files to be copied from theremote storage to the cache. For example, it may be the case that only asubset of the files of the bucket must be copied from the remotestorage. Ideally, each file of the bucket needed by the search wouldalready be prefetched into the cache, with no waiting required. Thesearch time is the time taken to execute the search query relative tothe files of the bucket.

1.0. General Overview

Modern data centers and other computing environments can compriseanywhere from a few host computer systems to thousands of systemsconfigured to process data, service requests from remote clients, andperform numerous other computational tasks. During operation, variouscomponents within these computing environments often generatesignificant volumes of machine-generated data. For example, machine datais generated by various components in the information technology (IT)environments, such as servers, sensors, routers, mobile devices,Internet of Things (IoT) devices, etc. Machine-generated data caninclude system logs, network packet data, sensor data, applicationprogram data, error logs, stack traces, system performance data, etc. Ingeneral, machine-generated data can also include performance data,diagnostic information, and many other types of data that can beanalyzed to diagnose performance problems, monitor user interactions,and to derive other insights.

A number of tools are available to analyze machine data, that is,machine-generated data. In order to reduce the size of the potentiallyvast amount of machine data that may be generated, many of these toolstypically pre-process the data based on anticipated data-analysis needs.For example, pre-specified data items may be extracted from the machinedata and stored in a database to facilitate efficient retrieval andanalysis of those data items at search time. However, the rest of themachine data typically is not saved and discarded during pre-processing.As storage capacity becomes progressively cheaper and more plentiful,there are fewer incentives to discard these portions of machine data andmany reasons to retain more of the data.

This plentiful storage capacity is presently making it feasible to storemassive quantities of minimally processed machine data for laterretrieval and analysis. In general, storing minimally processed machinedata and performing analysis operations at search time can providegreater flexibility because it enables an analyst to search all of themachine data, instead of searching only a pre-specified set of dataitems. This may enable an analyst to investigate different aspects ofthe machine data that previously were unavailable for analysis.

However, analyzing and searching massive quantities of machine datapresents a number of challenges. For example, a data center, servers, ornetwork appliances may generate many different types and formats ofmachine data (e.g., system logs, network packet data (e.g., wire data,etc.), sensor data, application program data, error logs, stack traces,system performance data, operating system data, virtualization data,etc.) from thousands of different components, which can collectively bevery time-consuming to analyze. In another example, mobile devices maygenerate large amounts of information relating to data accesses,application performance, operating system performance, networkperformance, etc. There can be millions of mobile devices that reportthese types of information.

These challenges can be addressed by using an event-based data intakeand query system, such as the SPLUNK® ENTERPRISE system developed bySplunk Inc. of San Francisco, Calif. The SPLUNK® ENTERPRISE system isthe leading platform for providing real-time operational intelligencethat enables organizations to collect, index, and searchmachine-generated data from various websites, applications, servers,networks, and mobile devices that power their businesses. The SPLUNK®ENTERPRISE system is particularly useful for analyzing data which iscommonly found in system log files, network data, and other data inputsources. Although many of the techniques described herein are explainedwith reference to a data intake and query system similar to the SPLUNK®ENTERPRISE system, these techniques are also applicable to other typesof data systems.

In the SPLUNK® ENTERPRISE system, machine-generated data are collectedand stored as “events”. An event comprises a portion of themachine-generated data and is associated with a specific point in time.For example, events may be derived from “time series data,” where thetime series data comprises a sequence of data points (e.g., performancemeasurements from a computer system, etc.) that are associated withsuccessive points in time. In general, each event can be associated witha timestamp that is derived from the raw data in the event, determinedthrough interpolation between temporally proximate events having knowntimestamps, or determined based on other configurable rules forassociating timestamps with events, etc.

In some instances, machine data can have a predefined format, where dataitems with specific data formats are stored at predefined locations inthe data. For example, the machine data may include data stored asfields in a database table. In other instances, machine data may nothave a predefined format, that is, the data is not at fixed, predefinedlocations, but the data does have repeatable patterns and is not random.This means that some machine data can comprise various data items ofdifferent data types and that may be stored at different locationswithin the data. For example, when the data source is an operatingsystem log, an event can include one or more lines from the operatingsystem log containing raw data that includes different types ofperformance and diagnostic information associated with a specific pointin time.

Examples of components which may generate machine data from which eventscan be derived include, but are not limited to, web servers, applicationservers, databases, firewalls, routers, operating systems, and softwareapplications that execute on computer systems, mobile devices, sensors,Internet of Things (IoT) devices, etc. The data generated by such datasources can include, for example and without limitation, server logfiles, activity log files, configuration files, messages, network packetdata, performance measurements, sensor measurements, etc.

The SPLUNK® ENTERPRISE system uses flexible schema to specify how toextract information from the event data. A flexible schema may bedeveloped and redefined as needed. Note that a flexible schema may beapplied to event data “on the fly,” when it is needed (e.g., at searchtime, index time, ingestion time, etc.). When the schema is not appliedto event data until search time it may be referred to as a “late-bindingschema.”

During operation, the SPLUNK® ENTERPRISE system starts with raw inputdata (e.g., one or more system logs, streams of network packet data,sensor data, application program data, error logs, stack traces, systemperformance data, etc.). The system divides this raw data into blocks(e.g., buckets of data, each associated with a specific time frame,etc.), and parses the raw data to produce timestamped events. The systemstores the timestamped events in a data store. The system enables usersto run queries against the stored data to, for example, retrieve eventsthat meet criteria specified in a query, such as containing certainkeywords or having specific values in defined fields. As used hereinthroughout, data that is part of an event is referred to as “eventdata”. In this context, the term “field” refers to a location in theevent data containing one or more values for a specific data item. Aswill be described in more detail herein, the fields are defined byextraction rules (e.g., regular expressions) that derive one or morevalues from the portion of raw machine data in each event that has aparticular field specified by an extraction rule. The set of values soproduced are semantically-related (such as IP address), even though theraw machine data in each event may be in different formats (e.g.,semantically-related values may be in different positions in the eventsderived from different sources).

As noted above, the SPLUNK® ENTERPRISE system utilizes a late-bindingschema to event data while performing queries on events. One aspect of alate-binding schema is applying “extraction rules” to event data toextract values for specific fields during search time. Morespecifically, the extraction rules for a field can include one or moreinstructions that specify how to extract a value for the field from theevent data. An extraction rule can generally include any type ofinstruction for extracting values from data in events. In some cases, anextraction rule comprises a regular expression where a sequence ofcharacters forms a search pattern, in which case the rule is referred toas a “regex rule.” The system applies the regex rule to the event datato extract values for associated fields in the event data by searchingthe event data for the sequence of characters defined in the regex rule.

In the SPLUNK® ENTERPRISE system, a field extractor may be configured toautomatically generate extraction rules for certain field values in theevents when the events are being created, indexed, or stored, orpossibly at a later time. Alternatively, a user may manually defineextraction rules for fields using a variety of techniques. In contrastto a conventional schema for a database system, a late-binding schema isnot defined at data ingestion time. Instead, the late-binding schema canbe developed on an ongoing basis until the time a query is actuallyexecuted. This means that extraction rules for the fields in a query maybe provided in the query itself, or may be located during execution ofthe query. Hence, as a user learns more about the data in the events,the user can continue to refine the late-binding schema by adding newfields, deleting fields, or modifying the field extraction rules for usethe next time the schema is used by the system. Because the SPLUNK®ENTERPRISE system maintains the underlying raw data and useslate-binding schema for searching the raw data, it enables a user tocontinue investigating and learn valuable insights about the raw data.

In some embodiments, a common field name may be used to reference two ormore fields containing equivalent data items, even though the fields maybe associated with different types of events that possibly havedifferent data formats and different extraction rules. By enabling acommon field name to be used to identify equivalent fields fromdifferent types of events generated by disparate data sources, thesystem facilitates use of a “common information model” (CIM) across thedisparate data sources (further discussed with respect to FIG. 5).

2.0. Operating Environment

FIG. 1 illustrates a networked computer system (100) in which anembodiment may be implemented. Those skilled in the art would understandthat FIG. 1 represents one example of a networked computer system andother embodiments may use different arrangements.

The networked computer system (100) comprises one or more computingdevices. These one or more computing devices comprise any combination ofhardware and software configured to implement the various logicalcomponents described herein. For example, the one or more computingdevices may include one or more memories that store instructions forimplementing the various components described herein, one or morehardware processors configured to execute the instructions stored in theone or more memories, and various data repositories in the one or morememories for storing data structures utilized and manipulated by thevarious components.

In an embodiment, one or more client devices (102) are coupled to one ormore host devices (106) and a data intake and query system (108) via oneor more networks (104). Networks (104) broadly represent one or moreLANs, WANs, cellular networks (e.g., LTE, HSPA, 3G, and other cellulartechnologies), and/or networks using any of wired, wireless, terrestrialmicrowave, or satellite links, and may include the public Internet.

2.1. Host Devices

In the illustrated embodiment, a system (100) includes one or more hostdevices (106). Host devices (106) may broadly include any number ofcomputers, virtual machine instances, and/or data centers that areconfigured to host or execute one or more instances of host applications(114). In general, a host device (106) may be involved, directly orindirectly, in processing requests received from client devices (102).Each host device (106) may comprise, for example, one or more of anetwork device, a web server, an application server, a database server,etc. A collection of host devices (106) may be configured to implement anetwork-based service. For example, a provider of a network-basedservice may configure one or more host devices (106) and hostapplications (114) (e.g., one or more web servers, application servers,database servers, etc.) to collectively implement the network-basedapplication.

In general, client devices (102) communicate with one or more hostapplications (114) to exchange information. The communication between aclient device (102) and a host application (114) may, for example, bebased on the Hypertext Transfer Protocol (HTTP) or any other networkprotocol. Content delivered from the host application (114) to a clientdevice (102) may include, for example, HTML documents, media content,etc. The communication between a client device (102) and hostapplication (114) may include sending various requests and receivingdata packets. For example, in general, a client device (102) orapplication running on a client device may initiate communication with ahost application (114) by making a request for a specific resource(e.g., based on an HTTP request), and the application server may respondwith the requested content stored in one or more response packets.

In the illustrated embodiment, one or more of host applications (114)may generate various types of performance data during operation,including event logs, network data, sensor data, and other types ofmachine-generated data. For example, a host application (114) comprisinga web server may generate one or more web server logs in which detailsof interactions between the web server and any number of client devices(102) is recorded. As another example, a host device (106) comprising arouter may generate one or more router logs that record informationrelated to network traffic managed by the router. As yet anotherexample, a host application (114) comprising a database server maygenerate one or more logs that record information related to requestssent from other host applications (114) (e.g., web servers orapplication servers) for data managed by the database server.

2.2. Client Devices

Client devices (102) of FIG. 1 represent any computing device capable ofinteracting with one or more host devices (106) via a network (104).Examples of client devices (102) may include, without limitation, smartphones, tablet computers, handheld computers, wearable devices, laptopcomputers, desktop computers, servers, portable media players, gamingdevices, and so forth. In general, a client device (102) can provideaccess to different content, for instance, content provided by one ormore host devices (106), etc. Each client device (102) may comprise oneor more client applications (110), described in more detail in aseparate section hereinafter.

2.3. Client Device Applications

In an embodiment, each client device (102) may host or execute one ormore client applications (110) that are capable of interacting with oneor more host devices (106) via one or more networks (104). For instance,a client application (110) may be or comprise a web browser that a usermay use to navigate to one or more websites or other resources providedby one or more host devices (106). As another example, a clientapplication (110) may comprise a mobile application or “app.” Forexample, an operator of a network-based service hosted by one or morehost devices (106) may make available one or more mobile apps thatenable users of client devices (102) to access various resources of thenetwork-based service. As yet another example, client applications (110)may include background processes that perform various operations withoutdirect interaction from a user. A client application (110) may include a“plug-in” or “extension” to another application, such as a web browserplug-in or extension.

In an embodiment, a client application (110) may include a monitoringcomponent (112). At a high level, the monitoring component (112)comprises a software component or other logic that facilitatesgenerating performance data related to a client device's operatingstate, including monitoring network traffic sent and received from theclient device and collecting other device and/or application-specificinformation. Monitoring component (112) may be an integrated componentof a client application (110), a plug-in, an extension, or any othertype of add-on component. Monitoring component (112) may also be astand-alone process.

In one embodiment, a monitoring component (112) may be created when aclient application (110) is developed, for example, by an applicationdeveloper using a software development kit (SDK). The SDK may includecustom monitoring code that can be incorporated into the codeimplementing a client application (110). When the code is converted toan executable application, the custom code implementing the monitoringfunctionality can become part of the application itself.

In some cases, an SDK or other code for implementing the monitoringfunctionality may be offered by a provider of a data intake and querysystem, such as a system (108). In such cases, the provider of thesystem (108) can implement the custom code so that performance datagenerated by the monitoring functionality is sent to the system (108) tofacilitate analysis of the performance data by a developer of the clientapplication or other users.

In an embodiment, the custom monitoring code may be incorporated intothe code of a client application (110) in a number of different ways,such as the insertion of one or more lines in the client applicationcode that call or otherwise invoke the monitoring component (112). Assuch, a developer of a client application (110) can add one or morelines of code into the client application (110) to trigger themonitoring component (112) at desired points during execution of theapplication. Code that triggers the monitoring component may be referredto as a monitor trigger. For instance, a monitor trigger may be includedat or near the beginning of the executable code of the clientapplication (110) such that the monitoring component (112) is initiatedor triggered as the application is launched, or included at other pointsin the code that correspond to various actions of the clientapplication, such as sending a network request or displaying aparticular interface.

In an embodiment, the monitoring component (112) may monitor one or moreaspects of network traffic sent and/or received by a client application(110). For example, the monitoring component (112) may be configured tomonitor data packets transmitted to and/or from one or more hostapplications (114). Incoming and/or outgoing data packets can be read orexamined to identify network data contained within the packets, forexample, and other aspects of data packets can be analyzed to determinea number of network performance statistics. Monitoring network trafficmay enable information to be gathered particular to the networkperformance associated with a client application (110) or set ofapplications.

In an embodiment, network performance data refers to any type of datathat indicates information about the network and/or network performance.Network performance data may include, for instance, a URL requested, aconnection type (e.g., HTTP, HTTPS, etc.), a connection start time, aconnection end time, an HTTP status code, request length, responselength, request headers, response headers, connection status (e.g.,completion, response time(s), failure, etc.), and the like. Uponobtaining network performance data indicating performance of thenetwork, the network performance data can be transmitted to a dataintake and query system (108) for analysis.

Upon developing a client application (110) that incorporates amonitoring component (112), the client application (110) can bedistributed to client devices (102). Applications generally can bedistributed to client devices (102) in any manner, or they can bepre-loaded. In some cases, the application may be distributed to aclient device (102) via an application marketplace or other applicationdistribution system. For instance, an application marketplace or otherapplication distribution system might distribute the application to aclient device based on a request from the client device to download theapplication.

Examples of functionality that enables monitoring performance of aclient device are described in U.S. patent application Ser. No.14/524,748, entitled “UTILIZING PACKET HEADERS TO MONITOR NETWORKTRAFFIC IN ASSOCIATION WITH A CLIENT DEVICE”, filed on 27 Oct. 2014, andwhich is hereby incorporated by reference in its entirety for allpurposes.

In an embodiment, the monitoring component (112) may also monitor andcollect performance data related to one or more aspects of theoperational state of a client application (110) and/or client device(102). For example, a monitoring component (112) may be configured tocollect device performance information by monitoring one or more clientdevice operations, or by making calls to an operating system and/or oneor more other applications executing on a client device (102) forperformance information. Device performance information may include, forinstance, a current wireless signal strength of the device, a currentconnection type and network carrier, current memory performanceinformation, a geographic location of the device, a device orientation,and any other information related to the operational state of the clientdevice.

In an embodiment, the monitoring component (112) may also monitor andcollect other device profile information including, for example, a typeof client device, a manufacturer and model of the device, versions ofvarious software applications installed on the device, and so forth.

In general, a monitoring component (112) may be configured to generateperformance data in response to a monitor trigger in the code of aclient application (110) or other triggering application event, asdescribed above, and to store the performance data in one or more datarecords. Each data record, for example, may include a collection offield-value pairs, each field-value pair storing a particular item ofperformance data in association with a field for the item. For example,a data record generated by a monitoring component (112) may include a“networkLatency” field (not shown in the Figure) in which a value isstored. This field indicates a network latency measurement associatedwith one or more network requests. The data record may include a “state”field to store a value indicating a state of a network connection, andso forth for any number of aspects of collected performance data.

2.4. Data Server System

FIG. 2 depicts a block diagram of an exemplary data intake and querysystem (108), similar to the SPLUNK® ENTERPRISE system. System (108)includes one or more forwarders (204) that receive data from a varietyof input data sources (202), and one or more indexers (206) that processand store the data in one or more data stores (208). These forwardersand indexers can comprise separate computer systems, or mayalternatively comprise separate processes executing on one or morecomputer systems.

Each data source (202) broadly represents a distinct source of data thatcan be consumed by a system (108). Examples of a data source (202)include, without limitation, data files, directories of files, data sentover a network, event logs, registries, etc.

During operation, the forwarders (204) identify which indexers (206)receive data collected from a data source (202) and forward the data tothe appropriate indexers. Forwarders (204) can also perform operationson the data before forwarding, including removing extraneous data,detecting timestamps in the data, parsing data, indexing data, routingdata based on criteria relating to the data being routed, and/orperforming other data transformations.

In an embodiment, a forwarder (204) may comprise a service accessible toclient devices (102) and host devices (106) via a network (104). Forexample, one type of forwarder (204) may be capable of consuming vastamounts of real-time data from a potentially large number of clientdevices (102) and/or host devices (106). The forwarder (204) may, forexample, comprise a computing device which implements multiple datapipelines or “queues” to handle forwarding of network data to indexers(206). A forwarder (204) may also perform many of the functions that areperformed by an indexer. For example, a forwarder (204) may performkeyword extractions on raw data or parse raw data to create events. Aforwarder (204) may generate time stamps for events. Additionally oralternatively, a forwarder (204) may perform routing of events toindexers. Data store (208) may contain events derived from machine datafrom a variety of sources all pertaining to the same component in an ITenvironment, and this data may be produced by the machine in question orby other components in the IT environment.

In one or more embodiments of the invention, data store (208) is anytype of storage unit and/or device (e.g., a file system, database,collection of tables, or any other storage mechanism) for storing data.Further, data store (208) may include multiple different storage unitsand/or devices. The multiple different storage units and/or devices mayor may not be of the same type or located at the same physical site.

Data store (208) may include a cache and remote storage. Cache is anytype of storage device from which data is accessed and processed by thesearch head (210) and/or indexer (206). Cache may be or may include RAMdisk, solid-state disks, and/or may be or include any other storage. Theremote storage is any storage that is remote in the data path relativeto the cache with respect to the search head (210) and/or indexer (206).In other words, whereas the search head may have direct access to thecache, the search head (210) and/or indexer (206) has indirect access tothe remote storage. The remote storage may or may not be physicallyremote from all or part of the remainder of the data intake and querysystem (108). For example, the remote storage may be a part of aphysical device having the remainder of one or more parts of the dataintake and query system (108), located in a different device andconnected via a network (e.g., intranet, virtual private network,Internet), or at another physical location. Cache may have fast accesstimes (e.g., latency) relative to remote storage. Cache may have lessstorage capacity than remote storage. The data (e.g., events) stored incache may be a subset of the data stored in remote storage. Theperformance of an indexer (206) may be enhanced when the data requestedby the indexer (206) resides in cache, rather than remote storage.

2.5. Data Ingestion

FIG. 3 depicts a flow chart illustrating an example data flow performedby Data Intake and Query system (108), in accordance with the disclosedembodiments. The data flow illustrated in FIG. 3 is provided forillustrative purposes only; those skilled in the art would understandthat one or more of the steps of the processes illustrated in FIG. 3 maybe removed or the ordering of the steps may be changed. Furthermore, forthe purposes of illustrating a clear example, one or more particularsystem components are described in the context of performing variousoperations during each of the data flow stages. For example, a forwarderis described as receiving and processing data during an input phase; anindexer is described as parsing and indexing data during parsing andindexing phases; and a search head is described as performing a searchquery during a search phase. However, other system arrangements anddistributions of the processing steps across system components may beused.

2.5.1. Input

At block (302), a forwarder receives data from an input source, such asa data source (202) shown in FIG. 2. A forwarder initially may receivethe data as a raw data stream generated by the input source. Forexample, a forwarder may receive a data stream from a log file generatedby an application server, from a stream of network data from a networkdevice, or from any other source of data. In one embodiment, a forwarderreceives the raw data and may segment the data stream into “blocks”, or“buckets,” possibly of a uniform data size, to facilitate subsequentprocessing steps.

At block (304), a forwarder or other system component annotates eachblock generated from the raw data with one or more metadata fields.These metadata fields may, for example, provide information related tothe data block as a whole and may apply to each event that issubsequently derived from the data in the data block. For example, themetadata fields may include separate fields specifying each of a host, asource, and a source type related to the data block. A host field maycontain a value identifying a host name or IP address of a device thatgenerated the data. A source field may contain a value identifying asource of the data, such as a pathname of a file or a protocol and portrelated to received network data. A source type field may contain avalue specifying a particular source type label for the data. Additionalmetadata fields may also be included during the input phase, such as acharacter encoding of the data, if known, and possibly other values thatprovide information relevant to later processing steps. In anembodiment, a forwarder forwards the annotated data blocks to anothersystem component (typically an indexer) for further processing.

The SPLUNK® ENTERPRISE system allows forwarding of data from one SPLUNK®ENTERPRISE instance to another, or even to a third-party system. SPLUNK®ENTERPRISE system can employ different types of forwarders in aconfiguration.

In an embodiment, a forwarder may contain the essential componentsneeded to forward data. It can gather data from a variety of inputs andforward the data to a SPLUNK® ENTERPRISE server for indexing andsearching. It also can tag metadata (e.g., source, source type, host,etc.).

Additionally or optionally, in an embodiment, a forwarder has thecapabilities of the aforementioned forwarder as well as additionalcapabilities. The forwarder can parse data before forwarding the data(e.g., associate a time stamp with a portion of data and create anevent, etc.) and can route data based on criteria such as source or typeof event. It can also index data locally while forwarding the data toanother indexer.

2.5.2. Parsing

At block (306), an indexer receives data blocks from a forwarder andparses the data to organize the data into events. In an embodiment, toorganize the data into events, an indexer may determine a source typeassociated with each data block (e.g., by extracting a source type labelfrom the metadata fields associated with the data block, etc.) and referto a source type configuration corresponding to the identified sourcetype. The source type definition may include one or more properties thatindicate to the indexer to automatically determine the boundaries ofevents within the data. In general, these properties may include regularexpression-based rules or delimiter rules where, for example, eventboundaries may be indicated by predefined characters or characterstrings. These predefined characters may include punctuation marks orother special characters including, for example, carriage returns, tabs,spaces, line breaks, etc. If a source type for the data is unknown tothe indexer, an indexer may infer a source type for the data byexamining the structure of the data. Then, it can apply an inferredsource type definition to the data to create the events.

At block (308), the indexer determines a timestamp for each event.Similar to the process for creating events, an indexer may again referto a source type definition associated with the data to locate one ormore properties that indicate instructions for determining a timestampfor each event. The properties may, for example, instruct an indexer toextract a time value from a portion of data in the event, to interpolatetime values based on timestamps associated with temporally proximateevents, to create a timestamp based on a time the event data wasreceived or generated, to use the timestamp of a previous event, or useany other rules for determining timestamps.

At block (310), the indexer associates with each event one or moremetadata fields including a field containing the timestamp (in someembodiments, a timestamp may be included in the metadata fields)determined for the event. These metadata fields may include a number of“default fields” that are associated with all events, and may alsoinclude one more custom fields as defined by a user. Similar to themetadata fields associated with the data blocks at block (304), thedefault metadata fields associated with each event may include a host,source, and source type field including or in addition to a fieldstoring the timestamp.

At block (312), an indexer may optionally apply one or moretransformations to data included in the events created at block (306).For example, such transformations can include removing a portion of anevent (e.g., a portion used to define event boundaries, extraneouscharacters from the event, other extraneous text, etc.), masking aportion of an event (e.g., masking a credit card number), removingredundant portions of an event, etc. The transformations applied toevent data may, for example, be specified in one or more configurationfiles and referenced by one or more source type definitions.

2.5.3. Indexing

At blocks (314) and (316), an indexer can optionally generate a keywordindex to facilitate fast keyword searching for event data. To build akeyword index, at block (314), the indexer identifies a set of keywordsin each event. At block (316), the indexer includes the identifiedkeywords in an index, which associates each stored keyword withreference pointers to events containing that keyword (or to locationswithin events where that keyword is located, other location identifiers,etc.). When an indexer subsequently receives a keyword-based query, theindexer can access the keyword index to quickly identify eventscontaining the keyword.

In some embodiments, the keyword index may include entries forname-value pairs found in events, where a name-value pair can include apair of keywords connected by a symbol, such as an equals sign or colon.This way, events containing these name-value pairs can be quicklylocated. In some embodiments, fields can automatically be generated forsome or all of the name-value pairs at the time of indexing. Forexample, if the string “dest=10.0.1.2” is found in an event, a fieldnamed “dest” may be created for the event, and assigned a value of“10.0.1.2”.

At block (318), the indexer stores the events with an associatedtimestamp in a data store (208). Timestamps enable a user to search forevents based on a time range. In one embodiment, the stored events areorganized into “buckets,” where each bucket stores events associatedwith a specific time range based on the timestamps associated with eachevent. This may not only improve time-based searching, but also allowsfor events with recent timestamps, which may have a higher likelihood ofbeing accessed, to be stored in a faster memory to facilitate fasterretrieval. For example, buckets containing the most recent events can bestored in flash memory rather than on a hard disk. In the example, theflash memory and the hard disk may be remote storage. In anotherexample, the flash memory is an example of cache and the hard disk maybe remote storage. Other configurations may be used without departingfrom the scope of the invention.

Each indexer (206) may be responsible for storing and searching a subsetof the events contained in a corresponding data store (208). Bydistributing events among the indexers and data stores, the indexers cananalyze events for a query in parallel. For example, using map-reducetechniques, each indexer returns partial responses for a subset ofevents to a search head that combines the results to produce an answerfor the query. By storing events in buckets for specific time ranges, anindexer may further optimize data retrieval process by searching bucketscorresponding to time ranges that are relevant to a query.

Moreover, events and buckets can also be replicated across differentindexers and data stores to facilitate high availability and disasterrecovery as described in U.S. patent application Ser. No. 14/266,812,entitled “SITE-BASED SEARCH AFFINITY”, filed on 30 Apr. 2014, and inU.S. patent application Ser. No. 14/266,817, entitled “MULTI-SITECLUSTERING”, also filed on 30 Apr. 2014, each of which is herebyincorporated by reference in its entirety for all purposes.

2.6. Query Processing

FIG. 4 is a flow diagram that illustrates an exemplary process that asearch head and one or more indexers may perform during a search query.At block (402), a search head receives a search query from a client. Atblock (404), the search head analyzes the search query to determine whatportion(s) of the query can be delegated to indexers and what portionsof the query can be executed locally by the search head. At block (406),the search head distributes the determined portions of the query to theappropriate indexers. In an embodiment, a search head cluster may takethe place of an independent search head where each search head in thesearch head cluster coordinates with peer search heads in the searchhead cluster to schedule jobs, replicate search results, updateconfigurations, fulfill search requests, etc. In an embodiment, thesearch head (or each search head) communicates with a master node (alsoknown as a cluster master, not shown in the Figure) that provides thesearch head with a list of indexers to which the search head candistribute the determined portions of the query. The master nodemaintains a list of active indexers and can also designate whichindexers may have responsibility for responding to queries over certainsets of events. A search head may communicate with the master nodebefore the search head distributes queries to indexers to discover theaddresses of active indexers.

At block (408), the indexers to which the query was distributed, searchdata stores associated with them for events that are responsive to thequery. To determine which events are responsive to the query, theindexer searches for events that match the criteria specified in thequery. These criteria can include matching keywords or specific valuesfor certain fields. The searching operations at block (408) may use thelate-binding schema to extract values for specified fields from eventsat the time the query is processed. In an embodiment, one or more rulesfor extracting field values may be specified as part of a source typedefinition. The indexers may then either send the relevant events backto the search head, or use the events to determine a partial result, andsend the partial result back to the search head.

At block (410), the search head combines the partial results and/orevents received from the indexers to produce a final result for thequery. This final result may comprise different types of data dependingon what the query requested. For example, the results can include alisting of matching events returned by the query, or some type ofvisualization of the data from the returned events. In another example,the final result can include one or more calculated values derived fromthe matching events.

The results generated by the system (108) can be returned to a clientusing different techniques. For example, one technique streams resultsor relevant events back to a client in real-time as they are identified.Another technique waits to report the results to the client until acomplete set of results (which may include a set of relevant events or aresult based on relevant events) is ready to return to the client. Yetanother technique streams interim results or relevant events back to theclient in real-time until a complete set of results is ready, and thenreturns the complete set of results to the client. In another technique,certain results are stored as “search jobs” and the client may retrievethe results by referring the search jobs.

The search head can also perform various operations to make the searchmore efficient. For example, before the search head begins execution ofa query, the search head can determine a time range for the query and aset of common keywords that all matching events include. The search headmay then use these parameters to query the indexers to obtain a supersetof the eventual results. Then, during a filtering stage, the search headcan perform field-extraction operations on the superset to produce areduced set of search results. This speeds up queries that are performedon a periodic basis.

2.7. Field Extraction

The search head (210) allows users to search and visualize event dataextracted from raw machine data received from homogenous data sources.It also allows users to search and visualize event data extracted fromraw machine data received from heterogeneous data sources. The searchhead (210) includes various mechanisms, which may additionally reside inan indexer (206), for processing a query. Splunk Processing Language(SPL), used in conjunction with the SPLUNK® ENTERPRISE system, can beutilized to make a query. SPL is a pipelined search language in which aset of inputs is operated on by a first command in a command line, andthen a subsequent command following the pipe symbol “|” operates on theresults produced by the first command, and so on for additionalcommands. Other query languages, such as the Structured Query Language(SQL), can be used to create a query.

In response to receiving the search query, search head (210) usesextraction rules to extract values for the fields associated with afield or fields in the event data being searched. The search head (210)obtains extraction rules that specify how to extract a value for certainfields from an event. Extraction rules can comprise regex rules thatspecify how to extract values for the relevant fields. In addition tospecifying how to extract field values, the extraction rules may alsoinclude instructions for deriving a field value by performing a functionon a character string or value retrieved by the extraction rule. Forexample, a transformation rule may truncate a character string, orconvert the character string into a different data format. In somecases, the query itself can specify one or more extraction rules.

The search head (210) can apply the extraction rules to event data thatit receives from indexers (206). Indexers (206) may apply the extractionrules to events in an associated data store (208). Extraction rules canbe applied to all the events in a data store, or to a subset of theevents that have been filtered based on some criteria (e.g., event timestamp values, etc.). Extraction rules can be used to extract one or morevalues for a field from events by parsing the event data and examiningthe event data for one or more patterns of characters, numbers,delimiters, etc., that indicate where the field begins and, optionally,ends.

FIG. 5 illustrates an example of raw machine data received fromdisparate data sources. In this example, a user submits an order formerchandise using a vendor's shopping application program (501) runningon the user's system. In this example, the order was not delivered tothe vendor's server due to a resource exception at the destinationserver that is detected by the middleware code (502). The user thensends a message to the customer support (503) to complain about theorder failing to complete. The three systems (501), (502), and (503) aredisparate systems that do not have a common logging format. The orderapplication (501) sends log data (504) to the SPLUNK® ENTERPRISE systemin one format, the middleware code (502) sends error log data (505) in asecond format, and the support server (503) sends log data (506) in athird format.

Using the log data received at one or more indexers (206) from the threesystems the vendor can uniquely obtain an insight into user activity,user experience, and system behavior. The search head (210) allows thevendor's administrator to search the log data from the three systemsthat one or more indexers (206) are responsible for searching, therebyobtaining correlated information, such as the order number andcorresponding customer ID number of the person placing the order. Thesystem also allows the administrator to see a visualization of relatedevents via a user interface. The administrator can query the search head(210) for customer ID field value matches across the log data from thethree systems that are stored at the one or more indexers (206). Thecustomer ID field value exists in the data gathered from the threesystems, but the customer ID field value may be located in differentareas of the data given differences in the architecture of thesystems—there is a semantic relationship between the customer ID fieldvalues generated by the three systems. The search head (210) requestsevent data from the one or more indexers (206) to gather relevant eventdata from the three systems. It then applies extraction rules to theevent data in order to extract field values that it can correlate. Thesearch head may apply a different extraction rule to each set of eventsfrom each system when the event data format differs among systems. Inthis example, the user interface can display to the administrator theevent data corresponding to the common customer ID field values (507),(508), and (509), thereby providing the administrator with insight intoa customer's experience.

Note that query results can be returned to a client, a search head, orany other system component for further processing. In general, queryresults may include a set of one or more events, a set of one or morevalues obtained from the events, a subset of the values, statisticscalculated based on the values, a report containing the values, or avisualization, such as a graph or chart, generated from the values.

2.8. Cloud-Based System Overview

The example data intake and query system (108) described in reference toFIG. 2 comprises several system components, including one or moreforwarders, indexers, and search heads. In some environments, a user ofa data intake and query system (108) may install and configure, oncomputing devices owned and operated by the user, one or more softwareapplications that implement some or all of these system components. Forexample, a user may install a software application on server computersowned by the user and configure each server to operate as one or more ofa forwarder, an indexer, a search head, etc. This arrangement generallymay be referred to as an “on-premises” solution. That is, the system(108) is installed and operates on computing devices directly controlledby the user of the system. Some users may prefer an on-premises solutionbecause it may provide a greater level of control over the configurationof certain aspects of the system (e.g., security, privacy, standards,controls, etc.). However, other users may instead prefer an arrangementin which the user is not directly responsible for providing and managingthe computing devices upon which various components of system (108)operate.

In one embodiment, to provide an alternative to an entirely on-premisesenvironment for system (108), one or more of the components of a dataintake and query system instead may be provided as a cloud-basedservice. In this context, a cloud-based service refers to a servicehosted by one more computing resources that are accessible to end usersover a network, for example, by using a web browser or other applicationon a client device to interface with the remote computing resources. Forexample, a service provider may provide a cloud-based data intake andquery system by managing computing resources configured to implementvarious aspects of the system (e.g., forwarders, indexers, search heads,etc.) and by providing access to the system to end users via a network.Typically, a user may pay a subscription or other fee to use such aservice. Each subscribing user of the cloud-based service may beprovided with an account that enables the user to configure a customizedcloud-based system based on the user's preferences.

FIG. 6 illustrates a block diagram of an example cloud-based data intakeand query system. Similar to the system of FIG. 2, the networkedcomputer system (600) includes input data sources (202) and forwarders(204). These input data sources and forwarders may be in a subscriber'sprivate computing environment. Alternatively, they might be directlymanaged by the service provider as part of the cloud service. In theexample system (600), one or more forwarders (204) and client devices(602) are coupled to a cloud-based data intake and query system (606)via one or more networks (604). Network (604) broadly represents one ormore LANs, WANs, cellular networks, intranet, etc., using any of wired,wireless, terrestrial microwave, satellite links, etc., and may includethe public Internet, and is used by client devices (602) and forwarders(204) to access the system (606). Similar to the system of (108), eachof the forwarders (204) may be configured to receive data from an inputsource and to forward the data to other components of the system (606)for further processing.

In an embodiment, a cloud-based data intake and query system (606) maycomprise a plurality of system instances (608). In general, each systeminstance (608) may include one or more computing resources managed by aprovider of the cloud-based system (606) made available to a particularsubscriber. The computing resources comprising a system instance (608)may, for example, include one or more servers or other devicesconfigured to implement one or more forwarders, indexers, search heads,and other components of a data intake and query system, similar tosystem (108). As indicated above, a subscriber may use a web browser orother application of a client device (602) to access a web portal orother interface that enables the subscriber to configure an instance(608).

Providing a data intake and query system as described in reference tosystem (108) as a cloud-based service presents a number of challenges.Each of the components of a system (108) (e.g., forwarders, indexers andsearch heads) may at times refer to various configuration files storedlocally at each component. These configuration files typically mayinvolve some level of user configuration to accommodate particular typesof data a user desires to analyze and to account for other userpreferences. However, in a cloud-based service context, users typicallymay not have direct access to the underlying computing resourcesimplementing the various system components (e.g., the computingresources comprising each system instance (608)) and may desire to makesuch configurations indirectly, for example, using one or more web-basedinterfaces. Thus, the techniques and systems described herein forproviding user interfaces that enable a user to configure source typedefinitions are applicable to both on-premises and cloud-based servicecontexts, or some combination thereof (e.g., a hybrid system where bothan on-premises environment such as SPLUNK® ENTERPRISE and a cloud-basedenvironment such as SPLUNK CLOUD™ are centrally visible).

2.9. Searching Externally Archived Data

FIG. 7 shows a block diagram of an example of a data intake and querysystem (108) that provides transparent search facilities for datasystems that are external to the data intake and query system. Suchfacilities are available in the HUNK® system provided by Splunk Inc. ofSan Francisco, Calif. HUNK® represents an analytics platform thatenables business and IT teams to rapidly explore, analyze, and visualizedata in Hadoop and NoSQL data stores.

The search head (210) of the data intake and query system receivessearch requests from one or more client devices (704) over networkconnections (720). As discussed above, the data intake and query system(108) may reside in an enterprise location, in the cloud, etc. FIG. 7illustrates that multiple client devices (704 a), (704 b), . . . , (704n) may communicate with the data intake and query system (108). Theclient devices (704) may communicate with the data intake and querysystem using a variety of connections. For example, one client device inFIG. 7 is illustrated as communicating over an Internet (Web) protocol,another client device is illustrated as communicating via a command lineinterface, and another client device is illustrated as communicating viaa system developer kit (SDK).

The search head (210) analyzes the received search request to identifyrequest parameters. If a search request received from one of the clientdevices (704) references an index maintained by the data intake andquery system, then the search head (210) connects to one or moreindexers (206) of the data intake and query system for the indexreferenced in the request parameters. That is, if the request parametersof the search request reference an index, then the search head accessesthe data in the index via the indexer. The data intake and query system(108) may include one or more indexers (206), depending on system accessresources and requirements. As described further below, the indexers(206) retrieve data from their respective local data stores (208) asspecified in the search request. The indexers and their respective datastores can comprise one or more storage devices and typically reside onthe same system, though they may be connected via a local networkconnection.

If the request parameters of the received search request reference anexternal data collection, which is not accessible to the indexers (206)or under the management of the data intake and query system, then thesearch head (210) can access the external data collection through anExternal Result Provider (ERP) process (710). An external datacollection may be referred to as a “virtual index” (plural, “virtualindices”). An ERP process provides an interface through which the searchhead (210) may access virtual indices.

Thus, a search reference to an index of the system relates to a locallystored and managed data collection. In contrast, a search reference to avirtual index relates to an externally stored and managed datacollection, which the search head may access through one or more ERPprocesses (710), (712). FIG. 7 shows two ERP processes (710), (712) thatconnect to respective remote (external) virtual indices, which areindicated as a Hadoop or another system (714) (e.g., Amazon S3, AmazonEMR, other Hadoop Compatible File Systems (HCFS), etc.) and a relationaldatabase management system (RDBMS) (718). Other virtual indices mayinclude other file organizations and protocols, such as Structured QueryLanguage (SQL) and the like. The ellipses between the ERP processes(710), (712) indicate optional additional ERP processes of the dataintake and query system (108). An ERP process may be a computer processthat is initiated or spawned by the search head (210) and is executed bythe search data intake and query system (108). Alternatively oradditionally, an ERP process may be a process spawned by the search head(210) on the same or different host system as the search head (210)resides.

The search head (210) may spawn a single ERP process in response tomultiple virtual indices referenced in a search request, or the searchhead may spawn different ERP processes for different virtual indices.Generally, virtual indices that share common data configurations orprotocols may share ERP processes. For example, all search queryreferences to a Hadoop file system may be processed by the same ERPprocess, if the ERP process is suitably configured. Likewise, all searchquery references to an SQL database may be processed by the same ERPprocess. In addition, the search head may provide a common ERP processfor common external data source types (e.g., a common vendor may utilizea common ERP process, even if the vendor includes different data storagesystem types, such as Hadoop and SQL). Common indexing schemes also maybe handled by common ERP processes, such as flat text files or Weblogfiles.

The search head (210) determines the number of ERP processes to beinitiated via the use of configuration parameters that are included in asearch request message. Generally, there is a one-to-many relationshipbetween an external results provider “family” and ERP processes. Thereis also a one-to-many relationship between an ERP process andcorresponding virtual indices that are referred to in a search request.For example, using RDBMS, assume two independent instances of such asystem by one vendor, such as one RDBMS for production and another RDBMSused for development. In such a situation, it is likely preferable (butoptional) to use two ERP processes to maintain the independent operationas between production and development data. Both of the ERPs, however,will belong to the same family, because the two RDBMS system types arefrom the same vendor.

The ERP processes (710), (712) receive a search request from the searchhead (210). The search head may optimize the received search request forexecution at the respective external virtual index. Alternatively, theERP process may receive a search request as a result of analysisperformed by the search head or by a different system process. The ERPprocesses (710), (712) can communicate with the search head (210) viaconventional input/output routines (e.g., standard in/standard out,etc.). In this way, the ERP process receives the search request from aclient device such that the search request may be efficiently executedat the corresponding external virtual index.

The ERP processes (710), (712) may be implemented as a process of thedata intake and query system. Each ERP process may be provided by thedata intake and query system, or may be provided by process orapplication providers who are independent of the data intake and querysystem. Each respective ERP process may include an interface applicationinstalled at a computer of the external result provider that ensuresproper communication between the search support system and the externalresult provider. The ERP processes (710), (712) generate appropriatesearch requests in the protocol and syntax of the respective virtualindices (714), (718), each of which corresponds to the search requestreceived by the search head (210). Upon receiving search results fromtheir corresponding virtual indices, the respective ERP process passesthe result to the search head (210), which may return or display theresults or a processed set of results based on the returned results tothe respective client device.

Client devices (704) may communicate with the data intake and querysystem (108) through a network interface (720), e.g., one or more LANs,WANs, cellular networks, and/or intranet using any of wired, wireless,terrestrial microwave, satellite links, etc., and may include the publicInternet.

The analytics platform utilizing the External Result Provider processdescribed in more detail in U.S. Pat. No. 8,738,629, entitled “EXTERNALRESULT PROVIDED PROCESS FOR RETRIEVING DATA STORED USING A DIFFERENTCONFIGURATION OR PROTOCOL”, issued on 27 May 2014, U.S. Pat. No.8,738,587, entitled “PROCESSING A SYSTEM SEARCH REQUEST BY RETRIEVINGRESULTS FROM BOTH A NATIVE INDEX AND A VIRTUAL INDEX”, issued on 25 Jul.2013, U.S. patent application Ser. No. 14/266,832, entitled “PROCESSINGA SYSTEM SEARCH REQUEST ACROSS DISPARATE DATA COLLECTION SYSTEMS”, filedon 1 May 2014, and U.S. patent application Ser. No. 14/449,144, entitled“PROCESSING A SYSTEM SEARCH REQUEST INCLUDING EXTERNAL DATA SOURCES”,filed on 31 Jul. 2014, each of which is hereby incorporated by referencein its entirety for all purposes.

2.9.1. ERP Process Features

The ERP processes described above may include two operation modes: astreaming mode and a reporting mode. The ERP processes can operate instreaming mode only, in reporting mode only, or in both modessimultaneously. Operating in both modes simultaneously is referred to asmixed mode operation. In a mixed mode operation, the ERP at some pointcan stop providing the search head with streaming results and onlyprovide reporting results thereafter, or the search head at some pointmay start ignoring streaming results it has been using and only usereporting results thereafter.

The streaming mode returns search results in real time, with minimalprocessing, in response to the search request. The reporting modeprovides results of a search request with processing of the searchresults prior to providing them to the requesting search head, which inturn provides results to the requesting client device. ERP operationwith such multiple modes provides greater performance flexibility withregard to report time, search latency, and resource utilization.

In a mixed mode operation, both streaming mode and reporting mode areoperating simultaneously. The streaming mode results (e.g., the raw dataobtained from the external data source) are provided to the search head,which can then process the results data (e.g., break the raw data intoevents, timestamp it, filter it, etc.) and integrate the results datawith the results data from other external data sources, and/or from datastores of the search head. The search head performs such processing andcan immediately start returning interim (streaming mode) results to theuser at the requesting client device; simultaneously, the search head iswaiting for the ERP process to process the data it is retrieving fromthe external data source as a result of the concurrently executingreporting mode.

In some instances, the ERP process initially operates in a mixed mode,such that the streaming mode operates to enable the ERP quickly toreturn interim results (e.g., some of the raw or unprocessed datanecessary to respond to a search request) to the search head, enablingthe search head to process the interim results and begin providing tothe client or search requester interim results that are responsive tothe query. Meanwhile, in this mixed mode, the ERP also operatesconcurrently in reporting mode, processing portions of raw data in amanner responsive to the search query. Upon determining that it hasresults from the reporting mode available to return to the search head,the ERP may halt processing in the mixed mode at that time (or somelater time) by stopping the return of data in streaming mode to thesearch head and switching to reporting mode only. The ERP at this pointstarts sending interim results in reporting mode to the search head,which in turn may then present this processed data responsive to thesearch request to the client or search requester. Typically, the searchhead switches from using results from the ERP's streaming mode ofoperation to results from the ERP's reporting mode of operation when thehigher bandwidth results from the reporting mode outstrip the amount ofdata processed by the search head in the streaming mode of ERPoperation.

A reporting mode may have a higher bandwidth because the ERP does nothave to spend time transferring data to the search head for processingall the raw data. In addition, the ERP may optionally direct anotherprocessor to do the processing.

The streaming mode of operation does not need to be stopped to gain thehigher bandwidth benefits of a reporting mode; the search head couldsimply stop using the streaming mode results—and start using thereporting mode results—when the bandwidth of the reporting mode hascaught up with or exceeded the amount of bandwidth provided by thestreaming mode. Thus, a variety of triggers and ways to accomplish asearch head's switch from using streaming mode results to usingreporting mode results may be appreciated by one skilled in the art.

The reporting mode can involve the ERP process (or an external system)performing event breaking, time stamping, filtering of events to matchthe search query request, and calculating statistics on the results. Theuser can request particular types of data, such as if the search queryitself involves types of events, or the search request may ask forstatistics on data, such as on events that meet the search request. Ineither case, the search head understands the query language used in thereceived query request, which may be a proprietary language. Oneexemplary query language is Splunk Processing Language (SPL) developedby the assignee of the application, Splunk Inc. The search headtypically understands how to use that language to obtain data from theindexers, which store data in a format used by the SPLUNK® Enterprisesystem.

The ERP processes support the search head, as the search head is notordinarily configured to understand the format in which data is storedin external data sources such as Hadoop or SQL data systems. Rather, theERP process performs that translation from the query submitted in thesearch support system's native format (e.g., SPL if SPLUNK® ENTERPRISEis used as the search support system) to a search query request formatthat will be accepted by the corresponding external data system. Theexternal data system typically stores data in a different format fromthat of the search support system's native index format, and it utilizesa different query language (e.g., SQL or MapReduce, rather than SPL orthe like).

As noted, the ERP process can operate in the streaming mode alone. Afterthe ERP process has performed the translation of the query request andreceived raw results from the streaming mode, the search head canintegrate the returned data with any data obtained from local datasources (e.g., native to the search support system), other external datasources, and other ERP processes (if such operations were required tosatisfy the terms of the search query). An advantage of mixed modeoperation is that, in addition to streaming mode, the ERP process isalso executing concurrently in reporting mode. Thus, the ERP process(rather than the search head) is processing query results (e.g.,performing event breaking, timestamping, filtering, possibly calculatingstatistics if required to be responsive to the search query request,etc.). It should be apparent to those skilled in the art that additionaltime is needed for the ERP process to perform the processing in such aconfiguration. Therefore, the streaming mode will allow the search headto start returning interim results to the user at the client devicebefore the ERP process can complete sufficient processing to startreturning any search results. The switchover between streaming andreporting mode happens when the ERP process determines that theswitchover is appropriate, such as when the ERP process determines itcan begin returning meaningful results from its reporting mode.

The operation described above illustrates the source of operationallatency: streaming mode has low latency (immediate results) and usuallyhas relatively low bandwidth (fewer results can be returned per unit oftime). In contrast, the concurrently running reporting mode hasrelatively high latency (it has to perform a lot more processing beforereturning any results) and usually has relatively high bandwidth (moreresults can be processed per unit of time). For example, when the ERPprocess does begin returning report results, it returns more processedresults than in the streaming mode, because, e.g., statistics only needto be calculated to be responsive to the search request. That is, theERP process doesn't have to take time to first return raw data to thesearch head. As noted, the ERP process could be configured to operate instreaming mode alone and return just the raw data for the search head toprocess in a way that is responsive to the search request.Alternatively, the ERP process can be configured to operate in thereporting mode only. Also, the ERP process can be configured to operatein streaming mode and reporting mode concurrently, as described, withthe ERP process stopping the transmission of streaming results to thesearch head when the concurrently running reporting mode has caught upand started providing results. The reporting mode does not require theprocessing of all raw data that is responsive to the search queryrequest before the ERP process starts returning results; rather, thereporting mode usually performs processing of chunks of events andreturns the processing results to the search head for each chunk.

For example, an ERP process can be configured to merely return thecontents of a search result file verbatim, with little or no processingof results. That way, the search head performs all processing (such asparsing byte streams into events, filtering, etc.). The ERP process canbe configured to perform additional intelligence, such as analyzing thesearch request and handling all the computation that a native searchindexer process would otherwise perform. In this way, the configured ERPprocess provides greater flexibility in features while operatingaccording to desired preferences, such as response latency and resourcerequirements.

3.0. Caching Subsystem 3.1. Cache Manager

FIG. 8A shows a cache manager (800), cache (830) and remote storage(840) in accordance with one or more embodiments. In one or moreembodiments, the cache (830) and remote storage (840) may be included ina data store (208). In one or more embodiments, the cache manager (800)may be implemented in hardware (e.g., circuitry), software, or anycombination thereof. The cache manager (800) may include functionalityto manage the contents of the cache (830) and remote storage (840). Forexample, the cache manager (800) may copy data from remote storage (840)to the cache (830) when an indexer (206) requests access to the data. Inone or more embodiments, the cache manager (800) may prefetch data(e.g., based on a prediction by the search bucket predictor (850) ofFIG. 8B), in order to avoid causing the indexer (206) to slow down orhalt processing activities due to waiting for data to be copied to cache(830).

As shown in FIG. 8A, the cache manager (800) includes a cache map (802).The remote storage (840) may include buckets (812). In one or moreembodiments, a bucket (812) may be associated with a specific timeframe. In other words, each bucket may be for a defined time range. Forexample, each bucket (812) may store events associated with a specifictime range based on the timestamps associated with each event. Bypartitioning data for events into buckets according to the timestamps ofthe event, one or more embodiments may not only improve time-basedsearching, but also allows for events with recent timestamps, which mayhave a higher likelihood of being accessed, to be stored in a fastermemory (e.g., cache (830)) to facilitate faster retrieval. For example,buckets (812) containing the most recent events may be stored in flashmemory rather than on a hard disk. By storing events in buckets (812)for specific time ranges, an indexer (206) may further optimize dataretrieval process by searching buckets (812) corresponding to timeranges that are relevant to a query. In one or more embodiments, abucket (812) may be associated with any criterion for describing acollection of data. In one or more embodiments, the various buckets(812) may be of uniform size.

Each bucket (812) may include files (814). A file (814) may represent alogical subdivision of the data contained in the bucket (812). In one ormore embodiments, a file (814) may be a metadata file, an index file, ajournal file, etc. In one or more embodiments, each file (814) has anassociated file type. Examples of file types may include: Bloom filter,metadata, index, and journal. In one or more embodiments, the relativesizes of these file types are, from smallest to largest: metadata, Bloomfilter, journal, and index.

In one or more embodiments, the remote storage (840) contains the fullcontents of each bucket (812). That is, the remote storage (840) maycontain each file (814) of each bucket (812). In contrast, in one ormore embodiments, the cache (830) may contain partial contents of asubset of the buckets (812) stored in the remote storage (840). That is,the cache (830) may contain a subset of the files (814) of a bucket(812). As an example, the cache (830) may store the metadata and indexfor a particular bucket (812), but not the corresponding journal.

A file (814) may, for example, provide information related to the datastored in the bucket (812) as a whole and may apply to each event thatis subsequently derived from the data in the bucket (812). For example,metadata may include separate fields specifying each of a host, asource, and a source type related to the bucket (812). A host field maycontain a value identifying a host name or IP address of a device thatgenerated the data. A source field may contain a value identifying asource of the data, such as a pathname of a file or a protocol and portrelated to received network data. A source type field may contain avalue specifying a particular source type label for the data. Additionalmetadata fields may also be included during the input phase, such as acharacter encoding of the data, if known, and possibly other values thatprovide information relevant to later processing steps. In anembodiment, a forwarder (204) forwards the annotated bucket (812) toanother system component (typically an indexer (206)) for furtherprocessing.

In one or more embodiments, a file (814) (e.g., an index file) mayassociate keywords with location references to events. The events may bestored in a file (814), which may contain raw data (e.g., data that hasbeen processed into events). In one or more embodiments, a file (814)may contain information used to generate associated files (814) (e.g., ajournal file may be used to generate a missing index file).

In one or more embodiments, a file (814) (e.g., a Bloom filter file) isa data structure used to test whether an element is a member of a set.For example, since a Bloom filter does not produce a false negativeresult, and therefore may be used to quickly determine whether a bucket(812) contains a specific keyword of a search query, and therebyeliminate the bucket (812) from further processing of the search query.

A file type may be defined by a file extension of the file, a filenameof the file, a data format of data in the file, another property of thefile, or any combination thereof.

In one or more embodiments, the files (814) of a bucket (812) may beprocessed in a sequence (e.g., by an indexer (206)) to execute a searchquery. An example of such a processing sequence may be:

1) evaluate a search query using metadata (e.g., using the metadata tohalt further processing of the bucket (812) if the search queryspecifies a value of a metadata field that is not satisfied by themetadata of the bucket (812));

2) evaluate the search query using a Bloom filter;

3) use the search query to query an index;

4) use the result of querying the index to access data in a journal.

Continuing with FIG. 8A, in one or more embodiments, the cache map (802)indicates an address of a file (814) of a bucket (812). The address ofthe file (814) may be in the cache (830). Alternatively, the address ofthe file (814) may be in remote storage (840). For example, in FIG. 8A,the file identifier (816) in the cache map (802) indicates that themetadata of bucket A (812) has a cache address (818). Similarly, thefile identifier (824) in the cache map (802) indicates that a journal ofbucket K (812) also has a cache address (818). In contrast, the fileidentifier (820) in the cache map (802) indicates that an index ofbucket A (812) has a remote address (822). In one or more embodiments,the size of a file (814) may be included in the entry in the cache map(802) corresponding to the file (814).

In one or more embodiments, the cache manager (800) includesfunctionality to manage the cache map (802). For example, the cachemanager (800) may include functionality to add, remove, and/or modify anentry in the cache map (802) to reflect an updated address of a file(814) (e.g., as files (814) are moved between the cache (830) and remotestorage (840)).

In one or more embodiments, the cache manager (800) includesfunctionality to respond to a request (e.g., from an indexer (206) or asearch head (210)) to access a file (814) by providing a cache address(818) of the file (814). In one or more embodiments, the cache manager(800) includes functionality to respond to the request to access thefile (814) by copying the file (814) from remote storage (840) to thecache (830). In one or more embodiments, the cache manager (800)includes functionality to respond to a request (e.g., from an indexer(206) or a search head (210)) to close (i.e., release access to) thefile (814). In one or more embodiments, the cache manager (800) includesfunctionality to respond to a request (e.g., from an indexer (206) or asearch head (210)) to close (i.e., release access to) a bucket (812). Inone or more embodiments, the cache manager (800) includes functionalityto respond to a request (e.g., from an indexer (206) or a search head(210)) to store the search time for a bucket (812).

3.2. Search Bucket Predictor

FIG. 8B shows a search bucket predictor (850) and cache (830) inaccordance with one or more embodiments. In one or more embodiments, thesearch bucket predictor (850) may be implemented in hardware (e.g.,circuitry), software, or any combination thereof. In one or moreembodiments, the search bucket predictor (850) may execute within asearch process created by an indexer (206). As shown in FIG. 8B, thesearch bucket predictor (850) implements a file usage history (852), aprefetch performance history (854), a bucket prefetch window (856), anda prefetch lookahead (858). In one or more embodiments, a file usagehistory (804) may include a usage status (872) and a copy status (874)associated with a file (814). In FIG. 8B, the file identifier (870) inthe file usage history (804) indicates a usage status (872) and a copystatus (874) associated with an index file (814) of bucket B (812). Inone or more embodiments, the usage status (872) associated with a file(814) may indicate whether or not the file (814) was used during theprocessing of a search query relative to the bucket (812) containing thefile (814). In one or more embodiments, the usage status (872) may havea binary value (e.g., “used” or “not used”). In one or more embodiments,the usage status (872) may have a numerical value, indicating a level ofusage of the file, or a number of accesses to the file. In one or moreembodiments, the file usage history (804) may be examined to determine ausage history corresponding to a specific file type (e.g., whether indexfiles been previously used for a given search query being executed).

In one or more embodiments, the copy status (874) associated with a file(814) may indicate whether or not the file (814) was copied to the cache(830). In one or more embodiments, the copy status (874) may have abinary value (e.g., “copied” or “not copied”). In one or moreembodiments, the copy status (830) may have a ternary value (e.g.,“copied on prefetch”, “copied on cache fault”, or “not copied”). In oneor more embodiments, the copy status (874) may be compared to the usagestatus (872) to evaluate the accuracy of a prefetching capability. Forexample, if the prefetching capability was 100% accurate, then a file(814) would be used each time the file (814) was copied.

In one or more embodiments, the file usage history (804) may be storedin the cache (830). In one or more embodiments, the file usage history(804) may include an identifier of a search query (not shown). Forexample, associating an entry of the file usage history (804)corresponding to a specific file (814) with a search query mayfacilitate analysis of trends in the usage and copy history of variousfiles (814), relative to different search queries.

In one or more embodiments, a prefetch performance history (854) mayinclude a wait time (876) and a search time (878) associated with abucket (812). In one or more embodiments, the wait time (876) is thetime that a search spends waiting for one or more files (814) of abucket (812) to be copied from the remote storage (840) to the cache(830). The wait time (876) for a bucket (812) may include the time dueto a cache fault that occurs when a file (814) needed for a search isnot already resident in the cache (830), and must be copied from remotestorage (840). The wait time (876) may also include the time due towaiting for a prefetched file (814) to be copied into the cache (830).For example, the prefetched file (814) may only be partially copied tothe cache (830) when the file (814) is requested by the search.

In one or more embodiments, the search time (878) is the time taken tosearch the files (814) of the bucket (812) to evaluate a search queryrelative to the bucket (812). For example, if the metadata, the index,and a journal have been used to evaluate a search query relative to abucket (812), the search time (878) for the bucket (812) includes thetime taken to search the metadata, the index, and the journal.

In one or more embodiments, the prefetch performance history (854) mayinclude an identifier of a search query (not shown). For example,associating an entry of the prefetch performance history (854)corresponding to a specific bucket (812) with a search query mayfacilitate analysis of trends in the prefetch performance of variousbuckets (812), relative to different search queries.

In one or more embodiments, the bucket prefetch window (856) indicateswhich buckets (812) are candidates for prefetching. In one or moreembodiments, prefetching a bucket (812) includes copying one or morefiles (814) of the bucket (812) into the cache (830). In one or moreembodiments, a file (814) of a bucket (812) is prefetched when the file(814) is copied from remote storage (840) to the cache (830) prior tobeing explicitly requested (e.g., requested by a search processexecuting on an indexer (206) processing a search request). In one ormore embodiments, a bucket (812) may be added to the bucket prefetchwindow (856) when the bucket (812) is identified as a candidate forprefetching.

The bucket prefetch window (856) may include references to buckets (812)whose files (814) are predicted to be used in the near term, during theexecution of a search query (e.g., performed by a search processexecuting on an indexer (206)). Once the processing of a bucket (812)has been completed, then the bucket (812) may be no longer needed (e.g.,closed) and may be removed from the bucket prefetch window (856)). Inone or more embodiments, the bucket prefetch window (856) may beadjusted as buckets (812) are searched (e.g., by an indexer (206)). Forexample, when a search completes its processing of a current bucket(812) and moves to the next bucket (812), the current bucket (812) maybe removed (e.g., “aged out”) from the bucket prefetch window (856).

The bucket prefetch window (856) may be thought of a window that slidesacross a list of buckets (812) as the buckets (812) are searched (e.g.,by a search process created by an indexer (206)). For example, if thebucket prefetch window (856) contains Bucket A Bucket B, and Bucket C,then once processing of Bucket A is completed, Bucket A may be removedfrom the bucket prefetch window (856) and the next bucket (812) in thelist of buckets (812) (e.g., Bucket D) may become a candidate forprefetching and may be added to the bucket prefetch window (856).

In one or more embodiments, the prefetch lookahead (858) represents atarget number of buckets (812) in the bucket prefetch window (856). Forexample, if the prefetch lookahead (858) has a value of four, then oneor more files (814) of four different buckets (812) may be prefetched. Alarger bucket prefetch window (856), and therefore a larger number ofprefetched files (814), may make it more likely that an indexer (206)may remain busy while waiting for other files (814) to be copied to thecache (830). In one or more embodiments, the prefetch lookahead (858)must be below a predetermined maximum value (e.g., based on the size ofthe cache (830)), in order to avoid degrading the performance of thecache (830).

In one or more embodiments, the search bucket predictor (850) includesfunctionality to manage the file usage history (804). For example, thesearch bucket predictor (850) may include functionality to add and/ormodify an entry in the file usage history (804) based on the usage of afile (814) (e.g., as files (814) are used to evaluate a search query).In addition, the search bucket predictor (850) may include functionalityto add and/or modify an entry in the file usage history (804) based onthe copy status (874) of a file (814) (e.g., as files (814) are copiedto the cache (830) from remote storage (840)). In one or moreembodiments, the search bucket predictor (850) includes functionality topredict the usage of a file (814) based on the file usage history (804)of one or more matching files (814) (e.g., files (814) having the samefile type or the same file name).

In one or more embodiments, the search bucket predictor (850) includesfunctionality to manage the prefetch performance history (854). Forexample, the search bucket predictor (850) may include functionality toadd and/or modify an entry in the prefetch performance history (854)based on the amount of time spent waiting for one or more files (814) ofa bucket (812) to be copied to the cache (830). In addition, the searchbucket predictor (850) may include functionality to add and/or modify anentry in the prefetch performance history (854) based on the amount oftime taken to evaluate a search query using one or more files (814) of abucket (812). Alternatively, in one or more embodiments, a searchprocess created by an indexer (206) may include functionality to managethe prefetch performance history (854).

In one or more embodiments, the search bucket predictor (850) includesfunctionality to manage the bucket prefetch window (856). For example,the search bucket predictor (850) may include functionality to add abucket (812) to the bucket prefetch window (856) (e.g., when the firstfile (814) of the bucket (812) is prefetched) and remove a bucket (812)from the bucket prefetch window (856) (e.g., when the bucket (812) isclosed for further processing). In one or more embodiments, the searchbucket predictor (850) includes functionality to adjust the prefetchlookahead (858). In one or more embodiments, the prefetch lookahead(858) may be adjusted based on one or more entries of the prefetchperformance history (854).

While FIG. 1, FIG. 2, FIG. 6, FIG. 7, FIG. 8A, and FIG. 8B showconfigurations of components, other configurations may be used withoutdeparting from the scope of the invention. For example, variouscomponents may be combined to create a single component. As anotherexample, the functionality performed by a single component may beperformed by two or more components.

3.3. Prefetching and Cache Aware Searching Methods

FIG. 9 shows a flowchart in accordance with one or more embodiments ofthe invention. The flowchart depicts a process for prefetching data. Inone or more embodiments, the process described in reference to FIG. 9may be practiced using one or more components described in reference toFIG. 1, FIG. 2, FIG. 6, FIG. 7, FIG. 8A, and FIG. 8B (e.g., the cachemanager (800) described in reference to FIG. 8A and/or the search bucketpredictor (850) described in reference to FIG. 8B). In one or moreembodiments of the invention, one or more of the steps shown in FIG. 9may be omitted, repeated, and/or performed in parallel, or in adifferent order than the order shown in FIG. 9. Accordingly, the scopeof the invention should not be considered limited to the specificarrangement of steps shown in FIG. 9.

Initially, in Step 900, a first bucket is copied from remote storage toa cache in response to a search query. In one or more embodiments, thefirst bucket may be included in a list of buckets identified in responseto the search query. For example, the list of buckets may be generatedand/or received. By way of an additional example, when the search headreceives a search request, the search head may generate the list ofbuckets that responds to the search request. The list of buckets may begenerated using information from the indexer and/or determined based ona time range in the search query. In one or more embodiments of theinvention, the cache manager may receive the list of buckets from thesearch head. Buckets may be processed to respond to the search query.

In Step 902, a first file type associated with a first file in the firstbucket and used in processing the search query is identified. Examplesof file types may include: metadata, Bloom filter, index, journal, rawdata, etc. Processing the search query using the first file may yieldone or more results. In one or more embodiments, a usage status of thefirst file may be assigned to indicate that the first file was usedduring the processing of the search query.

In Step 904, a second bucket from the remote storage is accessed, basedon the search query. The second bucket may be included in the list ofbuckets. The second bucket may be a bucket that has been previouslyprocessed (e.g., by an indexer, search head or other search processexecuting a search request).

In Step 906, a second file is identified in the second bucket having thefirst file type. For example, both the first file and the second filemay be index files. In one or more embodiments, the first file may bematched to the second file based on one or more matching criteria. Anexample of a matching criterion is whether the first file and the secondfile share the same file name or partial file name. Still anotherexample of a matching criterion is whether the first file and the secondfile are associated with identical or similar search queries. Both filesmay be associated with an identical search query that was executed atdifferent times (e.g., the search query may be a recurring query that isexecuted at periodic intervals). Alternatively, the first file thesecond file may be associated with similar search queries. For example,two search queries may be similar if they share a common sub-expression(e.g., “index x=foo”).

In Step 908, the second file is copied from the remote storage to thecache. That is, the second file may be copied to the cache prior tobeing explicitly requested (e.g., by an indexer or search processexecuting a search request). In other words, the first file may beprefetched. In one or more embodiments, copying the second file is inresponse to identifying the first file type used in processing thesearch query in Step 902 above. In one or more embodiments, an entry ina cache map may be added to indicate the address of the second file inthe cache. In one or more embodiments, the second file may be copiedbased on a rule that predicts the use of the second file based on theusage status of one or more files of one or more (e.g., previouslyprocessed) buckets. In one or more embodiments, the second bucket may beadded to a bucket prefetch window.

FIG. 10 shows a flowchart in accordance with one or more embodiments ofthe invention. The flowchart depicts a process for executing a searchrequest. Moreover, the flowchart in FIG. 10 may correspond to Step 408in FIG. 4. In one or more embodiments, the process described inreference to FIG. 10 may be practiced using one or more componentsdescribed in reference to FIG. 1, FIG. 2, FIG. 6, FIG. 7, FIG. 8A, andFIG. 8B (e.g., the indexer (206) described in reference to FIG. 2). Inone or more embodiments of the invention, one or more of the steps shownin FIG. 10 may be omitted, repeated, and/or performed in parallel, or ina different order than the order shown in FIG. 10. Accordingly, thescope of the invention should not be considered limited to the specificarrangement of steps shown in FIG. 10.

Initially, in Step 1000, a search request including a search query isreceived. In one or more embodiments, the search query may berepresented in Splunk Processing Language (SPL). Alternatively, thesearch query may be represented in another query language, such as theStructured Query Language (SQL). In one or more embodiments, the searchrequest may be received from a search head.

In Step 1002, a list of buckets is generated based on the searchrequest. See description of Step 900 above. In one or more embodiments,each bucket of the list of buckets includes a set of files. In one ormore embodiments, the files of one or more buckets in the list ofbuckets may be organized in an order in which the files may be processedto execute the search request.

In one or more embodiments, the list of buckets may be transmitted to asearch process spawned by the indexer. For example, the search processmay execute the search query relative to one or more buckets in the listof buckets. In one or more embodiments, the list of buckets may betransmitted to the cache manager (e.g., to trigger prefetching of one ormore files of one or more buckets in the list of buckets).

The list of buckets may be ordered in order to process the search query.For example, a bucket ordering criterion may specify that the buckets inthe list of buckets be examined based on time intervals associated withthe buckets. An example is that the buckets in the list of buckets maybe requested in reversed chronological order (e.g., where bucketscorresponding to more recent time intervals are examined beforeexamining buckets corresponding to less recent time intervals).

In Step 1004, a determination is made whether a file of a bucket in thelist of buckets is present in the cache. In particular, when processinga previous search query, the file from at least one of the buckets maybe present in the cache. If such a file is present, then the flowproceeds to Step 1006. In Step 1006, in response to the search query, asearch is performed using the file already present in the cache based onthe determination that the file is present in the cache. In other words,the file from the bucket may be processed out of order of the list ofbuckets. Thus, a file may be processed before other files in the samebucket or in a different bucket. Performing the search using a file isdiscussed in FIG. 10B below.

In one or more embodiments, the search is performed using the files thatare already present in the cache. Thus, Step 1006 may be performedmultiple times for each file that is already present in the cache.

In one or more embodiments, certain files may be used as a “gate” todetermine whether to continue processing the selected bucket. Forexample, a metadata file may be used to determine whether furtherprocessing of the selected bucket relative to the search query iswarranted (e.g., depending on whether a metadata field value specifiedin the search query is consistent with the metadata contained in theselected metadata file). Similarly, a Bloom filter may be used todetermine whether further processing of the selected bucket relative tothe search query is warranted. In addition, an index file may be used todetermine whether further processing of the selected bucket relative tothe search query is warranted (e.g., depending on whether a valuespecified in the search query is contained in the selected index file).A comparison may be performed on information in the gate file todetermine whether to perform additional processing of the bucket. If thecomparison indicates that the search query is not satisfied by thebucket, then the bucket is eliminated and remaining files are notprocessed in accordance with one or more embodiments of the invention.In contrast, if the comparison indicates that the search query may besatisfied, then the next file is processed.

By way of a more specific example, the metadata file may have a hostname, a source name, and a source type of corresponding events in thebucket. In the more specific example, if at least one of the host name,source name, and source type does not match the search query, then thebucket does not need to be processed. In other words, the files that actas a gate allows for eliminating buckets from being processed. Once abucket is eliminated, any remaining files are ignored and notdownloaded.

Even though gate files may exist in remote storage, the gate files maynot be used. For example, in some cases, the file that is alreadypresent in the cache is the larger file that has the events. In such ascenario, one or more embodiments determine a length of time todownload, to the cache, the gate file. If the length of time to downloadthe gate file is greater than a threshold, then the existing file in thecache is processed without downloading the gate file. For example, thethreshold may be the time to process the existing file. By way ofanother example, the threshold may be the time to process the existingfile with accounting for the likelihood that the bucket with theexisting file would be processed. Thus, in a scenario in which heavy useof the cache exists such that waiting until downloading the metadatafile is possible, the journal file may be processed without waiting fordownloading the metadata file if the journal file is already present inthe cache.

Continuing with FIG. 10, in Step 1008, a bucket is selected from thelist of buckets. In one or more embodiments, the selected bucket may bebased on a criterion for ordering the buckets in the list of buckets.

In Step 1010, a request is sent to open (i.e., access) the selectedbucket. In one or more embodiments, the request may be sent to the cachemanager.

In Step 1012, a file is selected from the set of files of the selectedbucket. In one or more embodiments, the selected file may be based on acriterion for ordering the files in the set of files.

In Step 1014, a request is sent to access the selected file of theselected bucket. In one or more embodiments, the request may be sent tothe cache manager. In one or more embodiments, a polling request may beperiodically sent to follow up on the request to access the selectedfile (e.g., until the address of the selected file in the cache isavailable).

In Step 1016, an address of the selected file is received. In one ormore embodiments, the address may refer to a location of the selectedfile in the cache.

In Step 1018, a result is generated based on evaluating the search queryusing the selected file. For example, if the selected file is a metadatafile, then the search query may be evaluated relative to the metadatacontained in the selected file to determine whether further processingof the first bucket relative to the search query is warranted. Forexample, if the search query specifies host=foo and the metadatacontained in the selected file indicates that the host=bar, then nofurther processing of the first bucket relative to the search query isneeded. In one or more embodiments, a usage status may be assigned tothe selected file based on using the selected file to process the searchquery.

In Step 1020, a request is sent to close the selected file of theselected bucket. That is, the request indicates that access to theselected file is no longer required by the search process executing thesearch request. In one or more embodiments, the selected file may stillbe accessed by one or more other search processes executing other searchrequests. In some embodiments, files are eliminated from the bucketbased on file size. In other words, larger files are eliminated from thebucket prior to smaller files.

In Step 1022, it is determined whether to continue processing the searchrequest with another file in the set of the files of the selectedbucket. That is, the result generated (in Step 1016 above) based onevaluating the search query relative to the selected file may be used asa gate that determines whether to continue processing the search requestusing additional files of the selected bucket. If Step 1022 determinesto continue processing the selected bucket, then execution continueswith Step 1010 above, with another selected file from the selectedbucket. That is, the loop from Step 1010 to Step 1020 may be repeatedwith another selected file from the selected bucket. Alternatively, ifStep 1022 determines to halt processing of the selected bucket, thenStep 1024 below is performed. In one or more embodiments, processing ofthe selected bucket may be halted when each file in the set of files ofthe selected bucket has been used during the processing of the searchrequest.

In Step 1024, a request is sent to close the selected bucket. That is,the request indicates that access to the selected bucket is no longerrequired by the search process executing the search request. Forexample, the search process may determine that it does not requireaccess to any additional files of the set of files of the selectedbucket. In one or more embodiments, the selected bucket may still beaccessed by one or more other search processes executing other searchrequests. In one or more embodiments, the now-closed selected bucket maybe removed from the bucket prefetch window.

The accumulation of stale buckets may be prevented by removing a bucketfrom the bucket prefetch window after a predetermined number of bucketssubsequent to the prefetched bucket in the list of buckets have beenprocessed (e.g., suggesting that the prefetched bucket is unlikely to beprocessed).

In Step 1026, the search time and the wait time for the selected bucketis stored. In one or more embodiments, the search time includes theprocessing time (e.g., CPU time) elapsed due to evaluating the searchquery using the selected file. In one or more embodiments, the searchtime for the selected bucket may be stored in the prefetch performancehistory entry corresponding to the selected bucket. In one or moreembodiments, the search time for the selected bucket includes the searchtimes for the files of the selected bucket that were used during theprocessing of the search request. In one or more embodiments, a requestto store the search time for the selected bucket may be sent to thebucket predictor (e.g., to avoid potential contention or race conditionsdue to accessing the prefetch performance history).

In one or more embodiments, the wait time is the time that a searchspends waiting for one or more files of the selected bucket to be copiedfrom the remote storage to the cache. In one or more embodiments, thewait time for the selected bucket may be stored in the prefetchperformance history entry corresponding to the selected bucket. The waittime may include the time due to a cache fault that occurs when a fileneeded for the search is not already resident in the cache. The waittime may also include the time due to waiting for a prefetched file tobe copied into the cache. In one or more embodiments, the search timeand the wait time for the selected bucket may be factors in determiningwhether to resize the bucket prefetch window (e.g., in Step 1318 of FIG.13B below).

In Step 1028, it is determined whether to continue processing of thesearch request with another bucket in the list of buckets. If Step 1028determines to continue processing another bucket, then executioncontinues with Step 1008 above, with another selected bucket. That is,the loop from Step 1008 to Step 1028 may be repeated for anotherselected bucket. Alternatively, if Step 1028 determines that there areno additional buckets to process, then Step 1030 below is performed.

In Step 1030, a result of processing the search request is returned. Inone or more embodiments, the result may be returned to the requestor(e.g., a search head) of the search request received in Step 1000. Inone or more embodiments, the result may be based on evaluating thesearch query relative to one or more files of one or more buckets in thebucket list generated in Step 1002 above.

FIG. 11 shows a flowchart in accordance with one or more embodiments ofthe invention. The flowchart depicts a process for prefetching data. Inone or more embodiments, the process described in reference to FIG. 11may be practiced using one or more components described in reference toFIG. 1, FIG. 2, FIG. 6, FIG. 7, FIG. 8A, and FIG. 8B (e.g., the cachemanager (800) described in reference to FIG. 8A and/or the search bucketpredictor (850) described in reference to FIG. 8B). 800 In one or moreembodiments of the invention, one or more of the steps shown in FIG. 11may be omitted, repeated, and/or performed in parallel, or in adifferent order than the order shown in FIG. 11. Accordingly, the scopeof the invention should not be considered limited to the specificarrangement of steps shown in FIG. 11.

Initially, in Step 1100, a list of buckets is received. In one or moreembodiments, the list of buckets may be received from an indexerexecuting a search request.

In Step 1102, a wait loop checks whether a size of the bucket prefetchwindow is below a prefetch lookahead. In one or more embodiments, theprefetch lookahead is a target number of buckets to prefetch. In one ormore embodiments, the bucket prefetch window may initially be empty.When the size of the bucket prefetch window is below the prefetchlookahead, execution proceeds to Step 1104 below. Otherwise, while thesize of the bucket prefetch window is not below the prefetch lookahead,the wait loop continues.

In Step 1104, a bucket is selected from the list of buckets. In one ormore embodiments, the selected bucket may be based on a criterion forordering the buckets in the list of buckets. For example, a bucketordering criterion may specify that the buckets in the list of bucketsbe examined based on time intervals associated with the buckets (e.g.,where buckets corresponding to earlier time intervals are examinedbefore examining buckets corresponding to later time intervals). Inaddition, the bucket ordering criterion may specify one or more initialbuckets to prefetch. In one or more embodiments, the bucket orderingcriterion may be received from an indexer (e.g., in Step 1100 above).

In Step 1106, a file is selected from the set of files of the selectedbucket. See description of Step 1008 above.

In Step 1108, a prediction is made regarding the usage of the selectedfile. In one or more embodiments, the prediction is the basis fordetermining whether to prefetch the selected file. The prediction may bebased on a usage history of matching files of one or more previouslyprocessed buckets. For example, the prediction may be based a usagestatus of one or more files having the same file type as the selectedfile, as indicated in the file usage history. The prediction may bebased on one or more prediction rules. For example, a prediction rulemay specify that if a journal file was used when processing a searchrequest relative to at least one of the two buckets processedimmediately prior to the selected bucket, then the journal file may beprefetched for the selected bucket. In one or more embodiments, variousother rules may be used to determine whether to copy (i.e., prefetch) afile based on the usage status of one or more other buckets.

Continuing this non-limiting example, the prediction rule may furtherconstrain the previously processed buckets to be buckets immediatelypreceding the selected bucket in the list of buckets. The predictionrule may further require that the usage status have a specified value(e.g., the value may be “used” or “not used”) in a specified number ofpreviously processed files.

Further continuing this non-limiting example, the specific number ofpreviously processed files required may be a parameter that may beadjusted based on a measure of the accuracy of one or more previouspredictions. For example, the accuracy measure may be based on how oftena prefetched file (e.g., as indicated by a copy status of the file inthe file usage history) was actually used during the processing of asearch request.

As another non-limiting example, a prediction rule may automaticallypredict usage of the selected file when there is no usage statusavailable for any files having the same file type as the selected filein previously processed buckets. For example, the selected bucket may bethe first bucket in the list of buckets examined by the cache manager,so there may be no current data upon which to base a prediction.

If the usage of the selected file is predicted, then execution proceedswith Step 1110 below. Otherwise, if the usage of the selected file isnot predicted, then execution proceeds with Step 1120 below.

In Step 1110, it is determined whether the selected bucket is in thebucket prefetch window. If the selected bucket is in the bucket prefetchwindow, then execution continues with Step 1114 below.

If the selected bucket is not in the bucket prefetch window, then inStep 1112 the selected bucket is added to the bucket prefetch window(e.g., the selected file is the first file of the selected bucket to beprefetched). The size of the bucket prefetch window therefore expands byone. In one or more embodiments, the bucket prefetch window includes areference to each bucket that contains at least one prefetched file.

In Step 1114, the selected file is copied from the remote storage to thecache. See description of Step 908 above. In one or more embodiments,while waiting for the selected file to be copied, another iteration ofthe loop beginning with Step 1106 and ending with Step 1120 may beexecuted, to determine whether another file in the selected bucket maybe a candidate for prefetching. In one or more embodiments, whilewaiting for the selected file to be copied, another iteration of thewait loop in Step 1102 above may be executed, to determine whether oneor more files in other buckets may be additional candidates forprefetching.

In Step 1116, the location of the selected file is updated in a cachemap. That is, the location of the selected file in the cache map may beupdated to indicate the cache address corresponding to the location ofthe selected file in the cache (e.g., instead of a remote storageaddress).

In Step 1118, the wait time of the selected file is tracked. In one ormore embodiments, the wait time is the time taken to copy the selectedfile from the remote storage to the cache.

In Step 1120, it is determined whether there are additional files of theset of files of the selected bucket. If there are additional files, thenexecution proceeds with Step 1106 above, to select another candidatefile for prefetching. In one or more embodiments, each file of the setof files of the selected bucket may be considered, in turn, as acandidate for prefetching. If there are no additional files, thenexecution then proceeds with the wait loop in Step 1102 above (e.g., towait until the size of the prefetch window falls below the prefetchlookahead). In one or more embodiments, the selected file may be used asa “gate” to determine whether to consider additional files of theselected bucket as candidates for prefetching. For example, if Step 1108above predicts that an index file of the selected bucket will not beused to process the search query, and therefore the index file is notprefetched, then it may be determined that a journal file of theselected bucket should also not be prefetched.

FIG. 12 shows a flowchart in accordance with one or more embodiments ofthe invention. The flowchart depicts a process for handling a request toaccess a file of a bucket. In one or more embodiments, the processdescribed in reference to FIG. 12 may be practiced using one or morecomponents described in reference to FIG. 1, FIG. 2, FIG. 6, FIG. 7,FIG. 8A, and FIG. 8B (e.g., the cache manager (800) described inreference to FIG. 8A and/or the search bucket predictor (850) describedin reference to FIG. 8B). In one or more embodiments of the invention,one or more of the steps shown in FIG. 12 may be omitted, repeated,and/or performed in parallel, or in a different order than the ordershown in FIG. 12. Accordingly, the scope of the invention should not beconsidered limited to the specific arrangement of steps shown in FIG.12.

Initially, in Step 1200, a request to access a file of a bucket isreceived. In one or more embodiments, the request may be received froman indexer executing a search request (e.g., in Step 1010 above).

In Step 1202, it is determined whether the file is in the cache. In oneor more embodiments, the cache map may be consulted to determine whetheran entry corresponding to the file exists in the cache. If the file isin the cache, then in Step 1204 a reference count of the file isincremented. For example, a reference count greater than zero mayindicate that the file is being referenced by at least one executingprocess (e.g., the originator of the request received in Step 1200), andtherefore should not be evicted from the cache.

In Step 1206, the address of the file in the cache is returned to theoriginator of the request received in Step 1200.

In Step 1208, a usage status is assigned to the file. In one or moreembodiments, the usage status may indicate that access to the file hasbeen requested (e.g., by an indexer executing a search query in Step1008 above). For example, the usage status may indicate a value of“used”. Alternatively, the usage status may have a numerical value basedon the number of times the file has been accessed. In one or moreembodiments, the usage status may be stored in an entry in a file usagehistory corresponding to the file.

Alternatively, if Step 1202 determines that the file is not in thecache, then in Step 1210 it is determined whether the cache is full. Ifthe cache is full, then in Step 1212 one or more cached files may beevicted until sufficient room exists in the cache to store the file. Inone or more embodiments, the size of the file may be obtained from theentry in the cache map corresponding to the file. In one or moreembodiments, the evicted files may have a reference count of zero (e.g.,the evicted files are no longer being accessed by any process executinga search request).

In Step 1214, the file is copied from the remote storage to the cache.See description of Step 904 above.

In Step 1216, the location of the file is updated in the cache map. Thatis, the location of the file in the entry in the cache map correspondingto the file may be updated to indicate the cache address correspondingto the location of the file in the cache (e.g., instead of a remotestorage address). After Step 1216 is performed, execution then proceedswith Step 1204 above.

FIG. 13A shows a flowchart in accordance with one or more embodiments ofthe invention. The flowchart depicts a process for handling a request toclose a file of a bucket. In one or more embodiments, the processdescribed in reference to FIG. 13A may be practiced using one or morecomponents described in reference to FIG. 1, FIG. 2, FIG. 6, FIG. 7,FIG. 8A, and FIG. 8B (e.g., the cache manager (800) described inreference to FIG. 8A and/or the search bucket predictor (850) describedin reference to FIG. 8B). In one or more embodiments of the invention,one or more of the steps shown in FIG. 13A may be omitted, repeated,and/or performed in parallel, or in a different order than the ordershown in FIG. 13A. Accordingly, the scope of the invention should not beconsidered limited to the specific arrangement of steps shown in FIG.13A.

Initially, in Step 1300, a request to close (i.e., release access to) afile of a bucket is received. In one or more embodiments, the requestmay be received from an indexer executing a search request (e.g., inStep 1016 above).

In Step 1302, a reference count of the file is decremented. In one ormore embodiments, the reference count is used to determine when the filemay be safely evicted from the cache. For example, a reference count ofzero may indicate that no process requires access to the file.

If, in Step 1304, it is determined that the reference count of the fileis zero, then in Step 1306 the file is marked for eviction from thecache. That is, the file may be evicted from the cache if additionalspace is required in the cache (e.g., to make room for additionalprefetched files of other buckets).

FIG. 13B shows a flowchart in accordance with one or more embodiments ofthe invention. The flowchart depicts a process for handling a request toclose a bucket. In one or more embodiments, the process described inreference to FIG. 13B may be practiced using one or more componentsdescribed in reference to FIG. 1, FIG. 2, FIG. 6, FIG. 7, FIG. 8A, andFIG. 8B (e.g., the cache manager (800) described in reference to FIG. 8Aand/or the search bucket predictor (850) described in reference to FIG.8B). In one or more embodiments of the invention, one or more of thesteps shown in FIG. 13B may be omitted, repeated, and/or performed inparallel, or in a different order than the order shown in FIG. 13B.Accordingly, the scope of the invention should not be considered limitedto the specific arrangement of steps shown in FIG. 13B.

Initially, in Step 1310, a request to close (i.e., release access to) abucket is received. In one or more embodiments, the request may bereceived from an indexer executing a search request (e.g., in Step 1020above).

In Step 1312, the wait time for the bucket is stored. In one or moreembodiments, the wait time for the bucket may be stored in the prefetchperformance history entry corresponding to the bucket. In one or moreembodiments, the wait time for the bucket includes the wait times forthe files of the bucket that were copied during the processing of thesearch request and/or the wait times for the files of the bucket thatwere prefetched (e.g., in Step 1114 above).

In Step 1314, the prefetch lookahead is recalculated based on a ratio ofthe wait time to the search time. In one or more embodiments, the targetsize of the bucket prefetch window, as represented by the prefetchlookahead, may be proportional to the amount of copying performed forthe files of the bucket. That is, when the wait time per bucket islarge, it may become more important to have a large buffer of prefetchedfiles for a search process (e.g., performed by an indexer) to work on inparallel with waiting for other non-prefetched files to be copied to thecache. In one or more embodiments, the prefetch lookahead may becalculated based on a ratio of the wait time to the search time,averaged for a predetermined number of recently closed buckets.

In one or more embodiments, the recalculated prefetch lookahead maytrigger additional prefetching in Step 1102 above in the method of FIG.11 (e.g., if the recalculated prefetch lookahead now exceeds the size ofthe bucket prefetch window). Recalculating the prefetch lookahead when abucket is closed provides a feedback mechanism that expands and shrinksthe size of the bucket prefetch window based on the amount of copyingrelative to the amount of searching for the closed bucket. For example,a larger-sized bucket prefetch window may reduce the amount of copyingneeded in the near term (e.g., due to the greater number of prefetchedfiles resulting from the larger bucket prefetch window), thereby causingthe bucket prefetch window to shrink when the prefetch lookahead is nextrecalculated. However, a smaller bucket prefetch window may increase thelikelihood of cache misses, which may increase the amount of copying,thereby causing the bucket prefetch window to expand when the prefetchlookahead is next recalculated, etc.

In Step 1316, usage predictions for other buckets in the bucket prefetchwindow are re-evaluated. In one or more embodiments, the usage status ofthe files in the now-closed bucket may be used to re-evaluate priorusage predictions made in Step 1108 above of FIG. 11 for one or morefiles in one or more buckets remaining in the bucket prefetch window.For example, a prior prediction that an index file of a Bucket B in theprefetch window would not be used may have resulted in a decision not toprefetch the index file of Bucket B. This prediction may be reconsideredin light of the usage of the index file of the now-closed bucket duringthe processing of the search query, which may trigger prefetching theindex file of Bucket B in Step 1114 above of FIG. 11.

3.4. Examples

The following example is for explanatory purposes only and not intendedto limit the scope of the invention. FIG. 14A and FIG. 14B show animplementation example in accordance with one or more embodiments of theinvention. FIG. 14A and FIG. 14B illustrate, in accordance with one ormore embodiments, the relative timing of steps performed by one or morecomponents described in reference to FIG. 1, FIG. 2, FIG. 6, FIG. 7,FIG. 8A, and FIG. 8B, in accordance with the flowcharts in FIG. 3, FIG.4, FIG. 9, FIG. 10, FIG. 11, FIG. 12, FIG. 13A, and FIG. 13B. Thesecomponents include: a search process (1402) (e.g., created by an indexer(206) in FIG. 2), the search bucket predictor (1404) ((850) in FIG. 8B),the cache manager (1406) ((800) in FIG. 8A), and the cache (1408) ((830)in FIG. 8A). One or more of the steps performed by the variouscomponents may proceed concurrently.

Initially, in Step 1410, the search process (1402) receives a searchrequest (e.g., from a search head (210) in FIG. 2) including a searchquery, called Query 24. Query 24 may be represented in Splunk ProcessingLanguage (SPL) or in another query language.

In Step 1412, the search process (1402) generates a list of bucketsbased on Query 24, and transmits the list of buckets to a search processspawned by the search process (1402). The search process may in turntransmit the list of buckets to the search bucket predictor (1404). Inthis example, the search process (1402) is already in the midst ofexecuting several other search queries (e.g., Query 1 thru Query 23),and resumes execution of these other search queries. That is, the searchprocess (1402) defers execution of Query 24 in order to give the cachemanager (1406) time to prefetch files that may be needed to executeQuery 24.

Turning to the search bucket predictor (1404), in Step 1450, uponobtaining the list of buckets from the search process (1402), the searchbucket predictor (1404) begins the process of determining which files inthe list of buckets should be prefetched, based on predictions regardingwhich files are likely to be needed to execute Query 24. The searchbucket predictor (1404) checks, in a wait loop, whether the bucketprefetch window size is less than the prefetch lookahead. In an initialscenario, where the search bucket predictor (1404) has just received thelist of buckets in Step 1412 above, the bucket prefetch window is empty,and the prefetch lookahead is set to 2. Therefore, the search bucketpredictor (1404) proceeds to Step 1452, and selects a bucket, in thiscase Bucket 1, from the list of buckets. For example, Bucket 1 may beselected because Bucket 1 is a bucket that has not yet been examined bythe search bucket predictor (1404) and Bucket 1 corresponds to theearliest time interval relative to the other unexamined buckets in thebucket list.

In Step 1454, search bucket predictor (1404) selects a file of Bucket 1,in this case the metadata file, from the set of files of Bucket 1. Forexample, the metadata file may be selected because the metadata file istypically a very small file, and it may be used to quickly rule out abucket from further processing of a search query. The set of files inBucket 1 also includes an index file and a journal file.

In Step 1456, search bucket predictor (1404) makes a prediction that themetadata file will be used during the execution of Query 24 relative toBucket 1. The search bucket predictor (1404) transmits the prediction tothe cache manager (1406). This prediction is based on the lack of anyusage status in a file usage history for any metadata files inpreviously processed buckets (i.e., Bucket 1 is the first bucketprocessed for Query 24). Therefore, based on the prediction, the cachemanager (1406) prepares to prefetch the metadata file of Bucket 1.

In an alternate scenario, Bucket 1 is not the first bucket processed inthe list of buckets. In this alternate scenario, Bucket X and Bucket Yhave been processed immediately prior to Bucket 1. A usage status existsin the file usage history for the metadata files in Bucket X and BucketY. In both Bucket X and Bucket Y, the metadata file was used during theprocessing of Query 24, while in Bucket Y, the metadata file was notused during the processing of Query 24 (e.g., Bucket Y contained a Bloomfilter which was used to rule out further processing of Bucket Yrelative to Query 24). In the alternate scenario, the search bucketpredictor (1404) uses a prediction rule that predicts usage of a filebased on a usage status of “used” in at least one of the immediatelypreceding buckets of the same file type. Therefore, in the alternatescenario, the search bucket predictor (1404) also predicts, in Step1456, that the metadata file will be used during the execution of Query24 relative to Bucket 1. Therefore, in both the original scenario andthe alternate scenario, the search bucket predictor (1404) prepares toprefetch the metadata file of Bucket 1.

In Step 1458, the cache manager (1406), based on the prediction by thesearch bucket predictor (1404) in Step 1456, copies the metadata file ofBucket 1 from the remote storage to the cache (1408). The cache manager(1406) also updates the location of the metadata file in the cache mapto indicate the cache address corresponding to the location of themetadata file in the cache (1408).

In Step 1462, the search bucket predictor (1404) adds Bucket 1 to thebucket prefetch window. Bucket 1 was not already in the bucket prefetchwindow because the metadata file is the first file prefetched fromBucket 1.

Next, the search bucket predictor (1404) considers the remaining filesof Bucket 1 as candidates for prefetching. In Step 1464, the searchbucket predictor (1404) selects the index file of Bucket 1.

In Step 1466, search bucket predictor (1404) makes a prediction that theindex file of Bucket 1 will not be used during the execution of Query 24relative to Bucket 1. For example, in the alternate scenario mentionedin Step 1456 above, Bucket X and Bucket Y of the list of buckets havebeen processed immediately prior to processing Bucket 1. The predictionregarding the index file of Bucket 1 is based on a usage status in thefile usage history for index files in Bucket X and Bucket Y, neither ofwhich used the index file during the processing of Query 24. Therefore,the index file of Bucket 1 is not prefetched.

In Step 1468, the search bucket predictor (1404) selects the journalfile of Bucket 1.

In Step 1470, search bucket predictor (1404) makes a prediction that thejournal file of Bucket 1 will not be used during the execution of Query24 relative to Bucket 1. The prediction regarding the journal file ofBucket 1 is based on a usage status in the file usage history for indexfiles in Bucket X and Bucket Y, neither of which used the journal fileduring the processing of Query 24. Therefore, the journal file of Bucket1 is not prefetched.

Now that each file of Bucket 1 has been examined as a candidate forprefetching, the search bucket predictor (1404) stores the wait time forBucket 1 (e.g., in the prefetch performance history entry correspondingto Bucket 1). The wait time for Bucket 1 is 100 milliseconds (i.e., thewait time for the metadata file copied in Step 1458 above).

Returning to the search process (1402), upon resuming its focus on Query24, in Step 1414, the search process (1402) selects Bucket 1 from thelist of buckets (e.g., the bucket corresponding to the earliest timeinterval). The search process (1402) may spawn a separate search processto execute Query 24 relative to Bucket 1.

In Step 1416, a search process spawned by the search process (1402)selects the metadata file from the set of files of Bucket 1 (e.g.,because the metadata file may be used to quickly rule out Bucket 1 forfurther processing of Query 24).

In Step 1418, the search process (1402) sends a request to the cachemanager (1406) to open (i.e., access) the metadata file of Bucket 1. Thesearch process (1402) periodically polls the cache manager (1406)regarding the status of this request.

In Step 1472, in response to the request of the search process (1402) inStep 1418 above, the cache manager (1406) sends the cache address of themetadata file of Bucket 1 to the search process (1402).

In Step 1474, the search bucket predictor (1404) assigns a usage statusof “used” to the metadata file of Bucket 1, now that the metadata filehas actually been opened in Step 1418 above. The usage status for themetadata file of Bucket 1 is stored in an entry in the file usagehistory corresponding to the metadata file of Bucket 1. The usage statusmay subsequently be used by the search bucket predictor (1404) topredict whether the metadata files of subsequent buckets are likely tobe used during the processing of Query 24. The search bucket predictor(1404) increments the reference count of the metadata file.

Returning to the search process (1402), in Step 1422, the search process(1402) generates a result of evaluating Query 24 using the metadata fileof Bucket 1. In this case, the result is that Bucket 1 does satisfy ametadata expression specified in Query 24. This is because Query 24specifies that the host field contain the value “server0001”, and themetadata file corresponding to Bucket 1 indicates that Bucket 1 doescontain data corresponding to a host field with the value “server0001”.

In Step 1424, the search process (1402) tracks the time to use themetadata file to search Bucket 1 relative to Query 24 in Step 1422above. The search time is 15 milliseconds. The search process (1402)also tracks the time spent waiting for the metadata file of Bucket 1.Since the metadata file was already prefetched, the wait time is only 10milliseconds.

In Step 1426, the search process (1402) sends a request to the cachemanager (1406) to close the metadata file of Bucket 1, now that thesearch process (1402) has completed its use of the metadata file. Uponreceiving this request, the cache manager (1406) decrements thereference count of the metadata file (e.g., once the reference countreaches zero, the metadata file may be a candidate for eviction from thecache (1408), in order to free up space to store other files).

Turning to FIG. 14B, which continues the timing diagram of FIG. 14A, inStep 1428, the search process (1402) determines whether to continueexecuting Query 24 using another file in the set of the files of Bucket1. That is, the result generated (in Step 1422 above) based onevaluating Query 24 relative to the metadata file is used as a gate todetermine whether to continue processing the search request usingadditional files of Bucket 1. In this case, the search process (1402)determines to continue searching Bucket 1, and performs Step 1430 below.Alternatively, if the search process (1402) had determined todiscontinue searching Bucket 1, then the search process (1402) wouldnext perform Step 1442 below, to close Bucket 1.

In Step 1430, the search process (1402) selects the index file from theset of files of Bucket 1. For example, the index file may be selectedbecause the index file may be used to quickly rule out the need to usethe journal file of Bucket 1, if the result of evaluating Query 24 usingthe index returns an empty result.

In Step 1432, the search process (1402) sends a request to the cachemanager (1406) to open the index file of Bucket 1.

However, in Step 1476, the cache manager (1406) detects a cache fault,since the index file of Bucket 1 was not prefetched to the cache (1408).Therefore, the prediction made by the search bucket predictor (1404) inStep 1466 above, that the index file of Bucket 1 would not be used toprocess Query 24, was incorrect. The search process (1402) will now beforced to wait for the cache manager (1406) to copy the index file tothe cache (1408).

In Step 1478, the cache manager (1406) copies the index file of Bucket 1from the remote storage to the cache (1408). The cache manager (1406)also updates the location of the index file of Bucket 1 in the cache mapto indicate the cache address corresponding to the location of themetadata file in the cache (1408).

In Step 1482, the cache manager (1406) sends the cache address of theindex file of Bucket 1 to the search process (1402).

In Step 1484, the search bucket predictor (1404) assigns a usage statusof “used” to the index file of Bucket 1. The usage status for the indexfile of Bucket 1 is stored in an entry in the file usage historycorresponding to the index file of Bucket 1. The cache manager (1406)increments the reference count of the index file.

Returning to the search process (1402), in Step 1436, the search process(1402) generates a result of evaluating Query 24 using the index file ofBucket 1. In this case, the result is that the index file of Bucket 1does not contain a keyword specified in Query 24. Therefore, processingof Bucket 1 relative to Query 24 is aborted. The journal file of Bucket1 is not needed to process Query 24. Therefore, the prediction made bythe search bucket predictor (1404) in Step 1470 above, that the journalfile of Bucket 1 would not be used to process Query 24, was correct.

In Step 1438, the search process (1402) tracks the time to use the indexfile to search Bucket 1 relative to Query 24 in Step 1436 above. Thesearch time is 35 milliseconds. The search process (1402) also tracksthe time spent waiting for the index file of Bucket 1. Since the indexfile was not already resident in the cache (1408), a cache faultoccurred, and the wait time was 240 milliseconds.

In Step 1440, the search process (1402) sends a request to the cachemanager (1406) to close the index file of Bucket 1, now that the searchprocess (1402) has completed its use of the index file. Upon receivingthis request, the cache manager (1406) decrements the reference count ofthe index file.

In Step 1442, the search process (1402) sends a request to the cachemanager (1406) to close Bucket 1, now that the search process (1402) hascompleted its processing of Bucket 1. The search process (1402) storesthe search time for Bucket 1 (e.g., in the prefetch performance historyentry corresponding to Bucket 1). The search time for Bucket 1 is 50milliseconds (i.e., the sum of the search times for the metadata fileand the index file during the processing of Query 24). Alternatively,the search process (1402) may request that the search bucket predictor(1404) store the search time for Bucket 1 (e.g., to avoid potentialcontention or race conditions due to accessing the prefetch performancehistory).

In response to the request of the search process (1402) to close Bucket1 in Step 1442 above, in Step 1490, the search bucket predictor (1404)removes Bucket 1 from the bucket prefetch window, since Bucket 1's filesno longer count as prefetched files that are predicted to be used duringfuture processing of Query 24. The size of the bucket prefetch windowshrinks by one.

In Step 1492, the search bucket predictor (1404) recalculates theprefetch lookahead based on the ratio of the wait time for Bucket 1 tothe search time for Bucket 1. The wait time for Bucket 1 is 250milliseconds (i.e., the sum of the wait times for the metadata file andthe index file). The search time for Bucket 1 is 50 milliseconds (i.e.,the sum of the search times for the metadata file and the index file).The ratio of the ratio of the wait time to the search time for Bucket 1is 5. Therefore, the target size of the bucket prefetch window, asrepresented by the prefetch lookahead, is set to 5. The recalculatedprefetch lookahead may trigger the cache manager (1406) to performadditional prefetching of files in the buckets of the list of buckets inthe wait loop of Step 1450 above, depending on the current size of thebucket prefetch window.

In Step 1494, the search bucket predictor (1404) may re-evaluate (e.g.,in the alternate scenario) prior usage predictions for other buckets inthe bucket prefetch window. That is, the usage status of the metadataand index files of Bucket 1 may be used to reverse prior usagepredictions made for metadata and/or index files in one or more bucketscurrently in the bucket prefetch window, potentially triggering theprefetching of the metadata and/or index files of these other buckets.

In Step 1444, the search process (1402) stores the search time and thewait time for Bucket 1 in the prefetch performance history.

The search process (1402) then continues its processing of Query 24relative to additional buckets in the list of buckets. Once all of thebuckets in the list of buckets have been processed, the search process(1402) returns the result of evaluating Query 24 relative to the list ofbuckets in Step 1446 (e.g., to the requestor of the search requestreceived in Step 1410).

FIG. 15 shows an example for performing cache aware searching inaccordance with one or more embodiments of the invention. The example isa simplified example for explanatory purposes only. In general, morefiles may exist in the cache and more buckets may be processed in thesearch query than shown in the example. In particular, FIG. shows astate of the cache at different time periods when a search query isprocessed. Turning to FIG. 15, consider the scenario in which a searchquery is received. Based on the result of the indexer, buckets 10-19 arerelevant to processing the search query. The number on the bucketsindicate the reverse chronological order on the buckets (i.e., bucket 10has the most recent events and bucket 19 has the least recent events).Other search queries may also be concurrently processed using the cache.FIG. 15A shows a state of the cache (1502) at time t1. As shown in FIG.15A, the cache includes the journal file of bucket 12 (1504) and themetadata file of bucket 14 (1506) based on the search query.

Because the metadata file of bucket 14 (1506) is already present in thecache, the metadata file of bucket 14 (1506) is processed without regardto the reverse chronological order. The metadata file of bucket 14(1504) is a gate file for bucket 14. By performing the search using themetadata file of bucket 14 (1504), a determination may be made whetherto request additional files in the cache for bucket 14. In the example,consider the scenario in which the result is not to bring in additionalfiles because the hostname in the metadata file does not match thehostname of the search query. Accordingly, the metadata file (1506) isset for eviction.

Additionally, the journal file of bucket 12 (1506) is also present inthe cache at the time that the search query is received. Based on theamount of time to evict other files to have enough storage space tostore the metadata file, a determination is made to process the journalfile out of order. Thus, the search is performed using the journal fileof bucket 12 (1506) without processing the metadata file or the bloomfilter file of bucket 12. In one or more embodiments, the search bucketpredictor does not request the prefetch of the metadata file or thebloom filter file.

At the same time or concurrently with processing the search using thejournal file of bucket 12 (1504) and the metadata file of bucket 14(1506), the search bucket predictor may start prefetching the remainingfiles to processing the search. The prefetching of the remaining filesmay be in the reverse chronological order of the buckets, such as usingthe technique described in example FIGS. 14A and 14B.

As shown, by performing cache aware searching, one or more embodimentsreduce the number of cache misses by performing the searching out oforder. Further, by considering the amount of time to download gatefiles, one or more embodiments process searches faster by not waitingfor gate files when less time is spent processing the non-gate files.

While the invention has been described with respect to a limited numberof embodiments, those skilled in the art, having benefit of thisdisclosure, will appreciate that other embodiments can be devised whichdo not depart from the scope of the invention as disclosed herein.Accordingly, the scope of the invention should be limited only by theattached claims.

What is claimed is:
 1. A method, comprising: in response to a searchquery, copying a first bucket from a remote storage to a cache, thefirst bucket including first data associated with the search query;identifying a first file type associated with a first file in the firstbucket, wherein the first file is associated with a first usage status;accessing, based on the search query, a second bucket from the remotestorage, the second bucket including second data associated with thesearch query; identifying a second file in the second bucket having thefirst file type; and copying, in response to the first usage statusindicating that the first file was used in processing the search query,the second file from the remote storage to the cache.
 2. The method ofclaim 1, further comprising: identifying a second file type associatedwith a third file in the first bucket; identifying a fourth file in thesecond bucket having the second file type; and copying the fourth filebased on a second usage status associated with the third file, whereinthe second usage status indicates that the third file was used duringthe processing of the search query.
 3. The method of claim 1, furthercomprising: identifying a second file type associated with a third filein the first bucket; identifying a fourth file in the second buckethaving the second file type; making a first determination whether tocopy the fourth file based on a second usage status associated with thethird file, wherein the second usage status indicates whether the thirdfile was used during the processing of the search query; making a seconddetermination, based at least in part on the first determinationindicating to copy the fourth file, whether to copy a fifth file of thesecond bucket having a third file type; and copying, based on the seconddetermination, the fifth file from the remote storage to the cache. 4.The method of claim 1, further comprising: accessing, based on thesearch query, a third bucket from the remote storage; identifying athird file in the third bucket having a second file type; and copyingthe third file based at least in part on a fourth file having the secondfile type, the fourth file being in one of two preceding processedbuckets, wherein the fourth file is associated with a second usagestatus indicating that the fourth file was used during the processing ofthe search query.
 5. The method of claim 1, further comprising: trackinga first wait time to access one or more files of the first bucket;tracking a first search time to process the search query using the firstbucket; and calculating a prefetch lookahead based on a ratio of thefirst wait time to the first search time, wherein the prefetch lookaheadrepresents a target number of buckets in a bucket prefetch window,wherein the bucket prefetch window indicates a set of buckets that arecandidates for prefetching, wherein prefetching comprises copying one ormore files of a bucket of the set of buckets from the remote storage tothe cache.
 6. The method of claim 1, further comprising: tracking afirst wait time to access one or more files of the first bucket;tracking a first search time to process the search query using the firstbucket; calculating a prefetch lookahead based on a ratio of the firstwait time to the first search time, wherein the prefetch lookaheadrepresents a target number of buckets in a bucket prefetch window,wherein the bucket prefetch window indicates a set of buckets that arecandidates for prefetching, wherein prefetching comprises copying one ormore files of a bucket of the set of buckets from the remote storage tothe cache; and in response to the prefetch lookahead exceeding a size ofthe bucket prefetch window: accessing, based on the search query, athird bucket from the remote storage; identifying a third file in thethird bucket having the first file type; and copying the third file fromthe remote storage to the cache.
 7. The method of claim 1, furthercomprising: tracking a first wait time to access one or more files ofthe first bucket; tracking a first search time to process the searchquery using the first bucket; calculating a prefetch lookahead based ona ratio of the first wait time to the first search time, wherein theprefetch lookahead represents a target number of buckets in a bucketprefetch window, wherein the bucket prefetch window indicates a set ofbuckets that are candidates for prefetching, wherein prefetchingcomprises copying one or more files of a bucket of the set of bucketsfrom the remote storage to the cache; tracking a second wait time toaccess one or more files of the second bucket; tracking a second searchtime to process the search query using the second bucket; recalculatingthe prefetch lookahead based on a ratio of the second wait time to thesecond search time; and resizing the bucket prefetch window in responseto recalculating the prefetch lookahead.
 8. The method of claim 1,further comprising: making a determination, based on evaluating thesearch query using the second file, whether to evaluate the search queryusing a third file of the second bucket having a second file type; andevaluating, based on the determination, the search query using the thirdfile.
 9. The method of claim 1, further comprising: receiving a requestto access a third file of the second bucket; making a determination, inresponse to receiving the request, that the third file is not in thecache; and copying, based on the determination, the third file from theremote storage to the cache.
 10. The method of claim 1, furthercomprising: identifying a third file in a third bucket having the firstfile type; making a determination, in response to the first usage statusindicating that the first file was not used in processing the searchquery, not to copy the third file from the remote storage to the cache;reversing the determination in response to a second usage status of afourth file of a recently processed bucket having the first file typeindicating that the fourth file was used in processing the search query;and copying, based on reversing the determination, the third file fromthe remote storage to the cache.
 11. The method of claim 1, wherein thefirst file type is one of a metadata file type, a Bloom filter filetype, an index file type, and a journal file type.
 12. The method ofclaim 1, wherein the first bucket comprises at least one event, eachevent in the at least one event comprising a portion of raw machine dataassociated with a timestamp.
 13. The method of claim 1, wherein thefirst bucket is associated with a first time frame and wherein thesecond bucket is associated with a second time frame.
 14. The method ofclaim 1, wherein the remote storage is located in a cloud storage or astorage in an on-premises environment.
 15. A computer system,comprising: a data store comprising a cache and a remote storage; acache manager configured to: in response to a search query, copy a firstbucket from the remote storage to the cache, the first bucket includingfirst data associated with the search query; access, based on the searchquery, a second bucket from the remote storage, the second bucketincluding second data associated with the search query; and copy, inresponse to a first usage status indicating that a first file in thefirst bucket was used in processing the search query, a second file inthe second bucket from the remote storage to the cache, wherein thefirst file is associated with the first usage status; and a searchbucket predictor configured to: identify a first file type associatedwith the first file; and identify the second file based on the secondfile having the first file type.
 16. The computer system of claim 15,wherein the search bucket predictor is further configured to: identify asecond file type associated with a third file in the first bucket;identify a fourth file in the second bucket having the second file type;and make a first determination whether to copy the fourth file based ona second usage status of the third file, wherein the second usage statusindicates whether the third file was used during the processing of thesearch query.
 17. The computer system of claim 15, wherein the searchbucket predictor is further configured to: identify a second file typeassociated with a third file in the first bucket; identify a fourth filein the second bucket having the second file type; make a firstdetermination whether to copy the fourth file based on a second usagestatus of the third file, wherein the second usage status indicateswhether the third file was used during the processing of the searchquery; and make a second determination, based at least in part on thefirst determination indicating to copy the fourth file, whether to copya fifth file of the second bucket having a third file type, and whereinthe cache manager is further configured to: copy, based on the seconddetermination, the fifth file from the remote storage to the cache. 18.The computer system of claim 15, wherein the cache manager is furtherconfigured to: access, based on the search query, a third bucket fromthe remote storage, and copy a third file in the third bucket based atleast in part on a fourth file having a second file type, the fourthfile being in one of two preceding processed buckets, wherein the fourthfile is associated with a second usage status indicating that the fourthfile was used during the processing of the search query, wherein thesearch bucket predictor is further configured to: identify the thirdfile having the second file type.
 19. The computer system of claim 15,wherein the search bucket predictor is further configured to: track afirst wait time to access one or more files of the first bucket; track afirst search time to process a search query using the first bucket; andcalculate a prefetch lookahead based on a ratio of the first wait timeto the first search time, wherein the prefetch lookahead represents atarget number of buckets in a bucket prefetch window, wherein the bucketprefetch window indicates a set of buckets that are candidates forprefetching, wherein prefetching comprises copying one or more files ofa bucket of the set of buckets from the remote storage to the cache. 20.The computer system of claim 15, wherein the cache manager is furtherconfigured to: access, based on the search query, a third bucket fromthe remote storage, and copy a third file in the third bucket from theremote storage to the cache, wherein the search bucket predictor isfurther configured to: track a first wait time to access one or morefiles of the first bucket; track a first search time to process a searchquery using the first bucket; calculate a prefetch lookahead based on aratio of the first wait time to the first search time, wherein theprefetch lookahead represents a target number of buckets in a bucketprefetch window, wherein the bucket prefetch window indicates a set ofbuckets that are candidates for prefetching, wherein prefetchingcomprises copying one or more files of a bucket of the set of bucketsfrom the remote storage to the cache; and in response to the prefetchlookahead exceeding a size of the bucket prefetch window, identify thethird file based on the third file having the first file type.
 21. Thecomputer system of claim 15, wherein the search bucket predictor isfurther configured to: track a first wait time to access one or morefiles of the first bucket; track a first search time to process a searchquery using the first bucket; calculate a prefetch lookahead based on aratio of the first wait time to the first search time, wherein theprefetch lookahead represents a target number of buckets in a bucketprefetch window, wherein the bucket prefetch window indicates a set ofbuckets that are candidates for prefetching, wherein prefetchingcomprises copying one or more files of a bucket of the set of bucketsfrom the remote storage to the cache; track a second wait time to accessone or more files of the second bucket; track a second search time toprocess the search query using the second bucket; recalculate theprefetch lookahead based on a ratio of the second wait time to thesecond search time; and resize the bucket prefetch window in response torecalculating the prefetch lookahead.
 22. The computer system of claim15, further comprising: an indexer configured to make a determination,based on evaluating the search query using the second file, whether toevaluate the search query using a third file of the second bucket havinga second file type, and evaluate, based on the determination, the searchquery using the third file.
 23. A non-transitory computer-readablemedium comprising instructions, execution of which in a computer systemcauses the computer system to: in response to a search query, copy afirst bucket from remote storage to a cache, the first bucket includingfirst data associated with the search query; identify a first file typeassociated with a first file in the first bucket, wherein the first fileis associated with a first usage status; access, based on the searchquery, a second bucket from the remote storage, the second bucketincluding second data associated with the search query; identify asecond file in the second bucket having the first file type; and copy,in response to the first usage status indicating that the first file wasused in processing the search query, the second file from the remotestorage to the cache.
 24. The non-transitory computer-readable medium ofclaim 23, wherein the instructions, upon execution, further cause thecomputer system to: identify a second file type associated with a thirdfile in the first bucket; identify a fourth file in the second buckethaving the second file type; and make a first determination whether tocopy the fourth file based on a second usage status of the third file,wherein the second usage status indicates whether the third file wasused during the processing of the search query.
 25. The non-transitorycomputer-readable medium of claim 23, wherein the instructions, uponexecution, further cause the computer system to: identify a second filetype associated with a third file in the first bucket; identify a fourthfile in the second bucket having the second file type; make a firstdetermination whether to copy the fourth file based on a second usagestatus of the third file, wherein the second usage status indicateswhether the third file was used during the processing of the searchquery; make a second determination, based at least in part on the firstdetermination indicating to copy the fourth file, whether to copy afifth file of the second bucket having a third file type; and copy,based on the second determination, the fifth file from the remotestorage to the cache.
 26. The non-transitory computer-readable medium ofclaim 23, wherein the instructions, upon execution, further cause thecomputer system to: access, based on the search query, a third bucketfrom the remote storage; identify a third file in the third buckethaving a second file type; and copy the third file based at least inpart on a fourth file having the second file type, the fourth file beingin one of two preceding processed buckets, wherein the fourth file isassociated with a second usage status indicating that the fourth filewas used during the processing of the search query.
 27. Thenon-transitory computer-readable medium of claim 23, wherein theinstructions, upon execution, further cause the computer system to:track a first wait time to access one or more files of the first bucket;track a first search time to process the search query using the firstbucket; and calculate a prefetch lookahead based on a ratio of the firstwait time to the first search time, wherein the prefetch lookaheadrepresents a target number of buckets in a bucket prefetch window,wherein the bucket prefetch window indicates a set of buckets that arecandidates for prefetching, wherein prefetching comprises copying one ormore files of a bucket of the set of buckets from the remote storage tothe cache.
 28. The non-transitory computer-readable medium of claim 23,wherein the instructions, upon execution, further cause the computersystem to: track a first wait time to access one or more files of thefirst bucket; track a first search time to process the search queryusing the first bucket; calculate a prefetch lookahead based on a ratioof the first wait time to the first search time, wherein the prefetchlookahead represents a target number of buckets in a bucket prefetchwindow, wherein the bucket prefetch window indicates a set of bucketsthat are candidates for prefetching, wherein prefetching comprisescopying one or more files of a bucket of the set of buckets from theremote storage to the cache; in response to the prefetch lookaheadexceeding a size of the bucket prefetch window: access, based on thesearch query, a third bucket from the remote storage; identify a thirdfile in the third bucket having the first file type; and copy the thirdfile from the remote storage to the cache.
 29. The non-transitorycomputer-readable medium of claim 23, wherein the instructions, uponexecution, further cause the computer system to: track a first wait timeto access one or more files of the first bucket; track a first searchtime to process the search query using the first bucket; calculate aprefetch lookahead based on a ratio of the first wait time to the firstsearch time, wherein the prefetch lookahead represents a target numberof buckets in a bucket prefetch window, wherein the bucket prefetchwindow indicates a set of buckets that are candidates for prefetching,wherein prefetching comprises copying one or more files of a bucket ofthe set of buckets from the remote storage to the cache; track a secondwait time to access one or more files of the second bucket; track asecond search time to process the search query using the second bucket;recalculate the prefetch lookahead based on a ratio of the second waittime to the second search time; and resize the bucket prefetch window inresponse to recalculating the prefetch lookahead.
 30. The non-transitorycomputer-readable medium of claim 23, wherein the instructions, uponexecution, further cause the computer system to: make a determination,based on evaluating the search query using the second file, whether toevaluate the search query using a third file of the second bucket havinga second file type; and evaluate, based on the determination, the searchquery using the third file.